• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Command not working
#1
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]

  Reply
#2
I think the problem is with your command processor.
  Reply
#3
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]

  Reply
#4
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.
  Reply
#5
(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]

  Reply
#6
(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.
  Reply
#7
Thank you everyone.
[Image: QIDa2vB.png]

  Reply


Forum Jump: