19.09.2011, 02:15
pawn Code:
//TOPO
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;
}
//OnPlayerCommandText
new string[128],
cmd[30],
tmp[30],
idx;
if(!strcmp(cmd,"/goto", true))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USE: /goto ID");
new outro = strval(tmp);
if(outro == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player desconhecido");
new
Float:X,
Float:Y,
Float:Z,
nome[MAX_PLAYER_NAME]
;
GetPlayerPos(outro, X, Y, Z);
SetPlayerPos(playerid, X, Y ,Z);
GetPlayerName(playerid, nome, sizeof(nome));
format(string, 42," Vocк usou /goto no player %s", nome);
SendClientMessage(playerid, -1, string);
return true;
}