problem in adding cmd
#1

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(playeridcmdtext[])
{
     if(
strcmp(cmdtext"/vehrot"true) == 0)
     {
          new 
currentveh;
          new 
Float:z_rot;
          new 
message[40];
 
          
currentveh GetPlayerVehicleID(playerid);
 
          
GetVehicleZAngle(currentvehz_rot);
 
          
format(messagesizeof(message), "The current vehicle rotation is: %.0f"z_rot);
 
          
SendClientMessage(playerid0xFFFFFFFFmessage);
 
          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
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)