[AJUDA] /sp e /ip
#2

PHP код:
new Float:Lugar[3];
new 
xyz[MAX_PLAYERS];
new 
Int;
public 
OnPlayerConnect(playerid)
{
    
xyz[playerid] = 0;
    return 
1;
}
public 
OnPlayerCommandText(playerid,cmdtext[])
{
    new 
idx;
    new 
cmd[256];
    new 
cmd strtok(cmdtext,idx);
    if(
strcmp(cmd,"/sp",true))
    {
        
Int GetPlayerInterior(playerid);
        
GetPlayerPos(playerid,Lugar[0],Lugar[1],Lugar[2]);
        
SendClientMessage(playerid,0xFFF55CFF,"Coordenadas salvas. Digite /ip para ir atй o local marcado.");
        
xyz[playerid] = 1;
        return 
1;
    }
    if(
strcmp(cmd,"/ip",true))
    {
        if(
xyz[playerid] == 0) return SendClientMessage(playerid,0xFFF55CFF,"Nenhuma coordenada foi salva atй agora.");
        
SetPlayerInterior(playerid,Int);
        
SetPlayerPos(playerid,Lugar[0],Lugar[1],Lugar[2]);
        if(
IsPlayerInAnyVehicle(playerid))
        {
            new 
carid GetPlayerVehicleID(playerid);
            
SetVehiclePos(carid,Lugar[0],Lugar[1],Lugar[2]);
            
LinkVehicleToInterior(caridInt);
            
PutPlayerInVehicle(playerid,carid);
            return 
1;
        }
        
SendClientMessage(playerid,0xFFF55CFF,"Vocк retornou ao local salvo.");
        return 
1;
    }
    return 
0;
}
//CASO VOCК NГO TENHA strtok, ADICONE ISTO NO FINAL DO SEU GM:
strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

Reply


Messages In This Thread
[AJUDA] /sp e /ip - by DPS|NeW| - 14.05.2011, 00:43
Re: [AJUDA] /sp e /ip - by Shadoww5 - 14.05.2011, 00:50
Re: [AJUDA] /sp e /ip - by Macintosh - 14.05.2011, 00:56
Re: [AJUDA] /sp e /ip - by DPS|NeW| - 14.05.2011, 01:08
Re: [AJUDA] /sp e /ip - by Shadoww5 - 14.05.2011, 01:10
Re: [AJUDA] /sp e /ip - by DPS|NeW| - 14.05.2011, 01:13
Re: [AJUDA] /sp e /ip - by Shadoww5 - 14.05.2011, 01:14
Re: [AJUDA] /sp e /ip - by TiagoPS - 14.05.2011, 01:36

Forum Jump:


Users browsing this thread: 2 Guest(s)