Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Command not working

 
  • 0 Vote(s) - 0 Average
Pawn Command not working
Snow
Offline

Burgershot Member
Posts: 48
Threads: 5
Joined: Oct 2020
Reputation: 2
Location: Pakistan
#1
2021-03-29, 06:25 PM (This post was last modified: 2021-03-29, 06:30 PM by Snow.)
Okay so I have this weird problem with this one specific command. When player performs this command, he gets teleported somewhere else instead of where he's supposed to. But I'm calling the same command under OnDialogResponse and it works fine there. Here's the command:
Code:
CMD:mc(playerid, params[])
{
    LoginCheck(playerid);
    SpawnCheck(playerid);
    IntCheck(playerid);

    if(!Permissions(playerid))
    return 1;

    SetCameraBehindPlayer(playerid);
    new RandomT = random(sizeof(mount));
    new Randomm = random(sizeof(mountv));

    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), mountv[Randomm][0], mountv[Randomm][1], mountv[Randomm][2]);
    }
    else
    {
        SetPlayerPos(playerid, mount[RandomT][0], mount[RandomT][1], mount[RandomT][2]);
    }
    new string[128], name[24];
    GetPlayerName(playerid, name, 24);
    format(string, 128, "%s(%d) has teleported to Mount Chilliad (/mc).", name, playerid);
    SendClientMessageToAll(COLOR_TP, string);
    return 1;
}

Calling it under dialog response like this
Code:
if(listitem ==7)
            {
            cmd_mc(playerid, "");
            }

Now when player types the command manually, he won't get teleported to Mount Chilliad but when he uses the dialog that calls this command, he'll be teleported here.
[Image: QIDa2vB.png]
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#2
2021-03-29, 09:43 PM
I think the problem is with your command processor.
Snow
Offline

Burgershot Member
Posts: 48
Threads: 5
Joined: Oct 2020
Reputation: 2
Location: Pakistan
#3
2021-03-29, 09:55 PM
But all other commands work fine from both sides i.e manually or via dialog. Only this one has the issue. I don't think it should be command processor.
[Image: QIDa2vB.png]
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#4
2021-03-30, 04:27 AM (This post was last modified: 2021-03-30, 04:28 AM by Radical.)
Well you may have a command with this name in one of your filterscripts. it will be executed first in the filter script and will not run in game mode.
Snow
Offline

Burgershot Member
Posts: 48
Threads: 5
Joined: Oct 2020
Reputation: 2
Location: Pakistan
#5
2021-03-30, 05:59 AM
(2021-03-30, 04:27 AM)Radical Wrote: Well you may have a command with this name in one of your filterscripts. it will be executed first in the filter script and will not run in game mode.

I've made sure of that. There's no such command in any other script.
[Image: QIDa2vB.png]
ImOver
Offline

Burgershot Member
Posts: 10
Threads: 0
Joined: Feb 2021
Reputation: 2
#6
2021-04-03, 07:55 PM
(2021-03-29, 06:25 PM)Snow Wrote: Okay so I have this weird problem with this one specific command. When player performs this command, he gets teleported somewhere else instead of where he's supposed to. But I'm calling the same command under OnDialogResponse and it works fine there. Here's the command:
Code:
CMD:mc(playerid, params[])
{
    LoginCheck(playerid);
    SpawnCheck(playerid);
    IntCheck(playerid);

    if(!Permissions(playerid))
    return 1;

    SetCameraBehindPlayer(playerid);
    new RandomT = random(sizeof(mount));
    new Randomm = random(sizeof(mountv));

    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), mountv[Randomm][0], mountv[Randomm][1], mountv[Randomm][2]);
    }
    else
    {
        SetPlayerPos(playerid, mount[RandomT][0], mount[RandomT][1], mount[RandomT][2]);
    }
    new string[128], name[24];
    GetPlayerName(playerid, name, 24);
    format(string, 128, "%s(%d) has teleported to Mount Chilliad (/mc).", name, playerid);
    SendClientMessageToAll(COLOR_TP, string);
    return 1;
}

Calling it under dialog response like this
Code:
if(listitem ==7)
            {
            cmd_mc(playerid, "");
            }

Now when player types the command manually, he won't get teleported to Mount Chilliad but when he uses the dialog that calls this command, he'll be teleported here.

Hey. Don't ever call a command like that "cmd_md(...)". And here's why https://github.com/pawn-lang/YSI-Include...#questions

I suggest you to use Y_Commands. And have you heard about functions. Use them. They exists for a reason.
Snow
Offline

Burgershot Member
Posts: 48
Threads: 5
Joined: Oct 2020
Reputation: 2
Location: Pakistan
#7
2021-04-04, 04:59 PM
Thank you everyone.
[Image: QIDa2vB.png]
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode