problem in adding cmd - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: problem in adding cmd (
/showthread.php?tid=607256)
problem in adding cmd -
BloodyDexter - 16.05.2016
hello
I was adding a new cmd to my game mode after adding it my pwn compiled successfully but when I replaced it to my game mode and go to my server all the cmds were unknown commands and server couldnt find any commands so I delete my changes
now I want to findput why it happend
this is the cmd I was adding /vehrot :
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/vehrot", true) == 0)
{
new currentveh;
new Float:z_rot;
new message[40];
currentveh = GetPlayerVehicleID(playerid);
GetVehicleZAngle(currentveh, z_rot);
format(message, sizeof(message), "The current vehicle rotation is: %.0f", z_rot);
SendClientMessage(playerid, 0xFFFFFFFF, message);
return 1;
}
return 0;
}
so in my gm used OnPlayerCommandText callback and I put this cmd code in end of it and didnt changed any thing at all (I am definitley sure beacuse I made this changes many time carefully)
I dont know why I have this problem
note:I didnt test it with other cmd codes maybe I have this problem just for this command ! and I was adding this command to findout vehicle z angle float it is very important for me if there is another way to find vehicle z angle or any programs to this pls help me
Re: problem in adding cmd -
BornHuman - 16.05.2016
Welcome to the SA:MP forums, first of all!
I want to make your life a lot easier so what I would suggest doing is forgetting OnPlayerCommandText and referring you to the
include zcmd.
You just download this, and put this in ./pawno/includes and at the top of your gamemode (somewhere under #include <a_samp>) write #include <zcmd>
Then you can create commands like this:
pawn Код:
CMD:vehrot(playerid, params[]
{
new currentveh, Float:z_rot, message[40];
currentveh = GetPlayerVehicleID(playerid);
GetVehicleZAngle(currentveh, z_rot);
format(message, sizeof(message), "The current vehicle rotation is: %.0f", z_rot);
SendClientMessage(playerid, 0xFFFFFFFF, message);
return 1;
}