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


Messages In This Thread
Command not working - by Snow - 2021-03-29, 06:25 PM
RE: Command not working - by Radical - 2021-03-29, 09:43 PM
RE: Command not working - by Snow - 2021-03-29, 09:55 PM
RE: Command not working - by Radical - 2021-03-30, 04:27 AM
RE: Command not working - by Snow - 2021-03-30, 05:59 AM
RE: Command not working - by ImOver - 2021-04-03, 07:55 PM
RE: Command not working - by Snow - 2021-04-04, 04:59 PM

Forum Jump: