[HELP]
#1

....
Reply
#2

since i hate strcmp i dont know why , anyway , this should work

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
     if(!
strcmp("/go"cmdtext))
     {
      if(
IsInDM[playerid] ==1)
        {
        
SendClientMessage(playerid,COLOR_RED,"You can't gos at Dm ; /leavedm");
        return 
1;
        }
    new 
ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
    
if(sscanf(params"u"ID)) return SendClientMessage(playerid0xFF0000FF"USAGE: /go [id]");//checks if you have written something after /goto if no it sends error
    
else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid0xFF0000FF"This player is offline or it is yourself");
    if(
GotoDisabled[ID] == 1)
    {
        new 
string[50], name[MAX_PLAYER_NAME];
        
format(stringsizeof(string), "%s's goto is disabled!"GetPlayerName(playeridnamesizeof(name)));
        
GameTextForPlayer(playerid,string,2000,3);
        return 
1;
    }
    else
//ELSE what will happen if no errors
        
{
        new 
Float:xFloat:yFloat:z;//creates new floats
        
GetPlayerPos(IDxyz);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
        
SetPlayerPos(playeridx+1y+1z);//sets the player position the id of that player +1 in x +1 in y and z remains same as it defines height
        
}
     }
     
    if(!
strcmp("/gos"cmdtext))
    if(
IsPlayerConnected(playerid))
        {
            if(
GotoDisabled[playerid] == 1)
            {
                
GotoDisabled[playerid] = 0;
                
GameTextForPlayer(playerid,"~b~You have ~r~enabled ~b~gos",2000,3);
                return 
1;
            }
            else
            {
                
GotoDisabled[playerid] = 1;
                
GameTextForPlayer(playerid,"~b~You have ~r~disabled ~b~gos",2000,3);
                return 
1;
            }
        }
    return 
0;

good luck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)