/goto
#4

Quote:
Originally Posted by K3nX
Посмотреть сообщение
Use this, take some parts out considering of your GM.
PHP код:
CMD:goto(playerid,params[])
{
    if(
AdminLevel[playerid] >= 5) {
    new 
string[128];
    new 
ID;
    if(
sscanf(params,"u",ID))
    {
        
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /goto (Player Name/ID)");
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot goto them.",ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    if(
IsSpawned[playerid] != 1)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 
1;
    }
    if(
IsSpawned[ID] != 1)
    {
        
format(string,sizeof(string),"%s(%d) is not spawned. You cannot goto dead people ..",PlayerName(ID),ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(ID,x,y,z);
    
    
SetPlayerPos(playerid,x+1,y,z);
    
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ID));
    
SetPlayerInterior(playerid,GetPlayerInterior(ID));
    
format(string,sizeof(string),"You have teleported to %s(%d).",PlayerName(ID),ID);
    
SendClientMessage(playerid,COLOR_ADMIN,string);
    }
    return 
1;

a lot useless lines which takes from memory
pawn Код:
CMD:goto(playerid,params[])
{
    if(AdminLevel[playerid] < 5) return 0; //or return 1
    new string[128],ID;
    if(sscanf(params,"u",ID)) return SendClientMessage(playerid,COLOR_ERROR,"USAGE: /goto (Player Name/ID)");
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot goto them.",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(IsSpawned[playerid] != 1) return SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
    if(IsSpawned[ID] != 1)
    {
        format(string,sizeof(string),"%s(%d) is not spawned. You cannot goto dead people ..",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    new Float:x,Float:y,Float:z;
    GetPlayerPos(ID,x,y,z);
    SetPlayerPos(playerid,x+1,y,z);
    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ID));
    SetPlayerInterior(playerid,GetPlayerInterior(ID));
    format(string,sizeof(string),"You have teleported to %s(%d).",PlayerName(ID),ID);
    SendClientMessage(playerid,COLOR_ADMIN,string);
    return 1;
}
Reply


Messages In This Thread
/goto - by lakshikagayal - 25.05.2013, 04:32
Re: /goto - by DobbysGamertag - 25.05.2013, 04:36
---------- - by K3nX - 25.05.2013, 04:42
Re: /goto - by mineralo - 25.05.2013, 05:30

Forum Jump:


Users browsing this thread: 2 Guest(s)