14.05.2011, 00:50
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(carid, Int);
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;
}