16.04.2011, 15:07
pawn Код:
COMMAND:get(playerid,params[]) {
new
Float:pos1,
Float:pos2,
Float:pos3,
interior,
temp[30],
id,
name1[30],
name2[30],
text[128];
if(sscanf(params,"s",temp))
return SendClientMessage(playerid,red,"USAGE: /get [part of name]");
id = GetPlayerID(temp);
if(PlayerInfo[playerid][pAdminLevel] >= 3) {
if(IsPlayerConnected(id)) {
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
GetPlayerPos(playerid,pos1,pos2,pos3);
format(text,sizeof(text),"Administrator \"%s\" has teleported \"%s\" to his / her position.",name1,name2);
SendClientMessageToAll(medblue,text);
interior = GetPlayerInterior(playerid);
SetPlayerPos(id,pos1+2,pos2+2,pos3);
SetPlayerInterior(id,interior);
} else {
return SendClientMessage(playerid,red,"Invalid name.");
}
} else {
return SendClientMessage(playerid,red,"Only lvl3 admins can use this command.");
}
return 1;
}
Can u help me?
Please correct, not rewrite the code.
P.S.: oh almost forgot:
pawn Код:
stock GetPlayerID(const Name[])
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
if(strcmp(Name, pName, true)==0)
{
return i;
}
}
}
return -1;
}