hi, ich hab mal ne frage, wenn man z. B. das hier hat:
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[128], string[128], cmd[128], idx, giveplayerid, sendername, giveplayer;
cmd = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(strcmp(cmd, "/akill", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x919191FF, "You must be admin to admin-kill someone.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0x919191FF, "Usage: \"/akill [ID]\"");
giveplayerid = strval(tmp);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(!IsPlayerConnected(giveplayerid))SendClientMessage(playerid, 0x919191FF, "Player not found.");
SetPlayerHealth(giveplayerid, 0);
format(string, sizeof(string), "Admin %s[%i] killed you!", sendername, playerid);
SendClientMessage(giveplayerid, 0xE21D2CFF, string);
format(string, sizeof(string), "Killed %s[%i]!", giveplayer, giveplayerid);
SendClientMessage(playerid, 0xE21D2CFF, string);
return 1;
}
}
wofür braucht man hier überhaupt die variable "tmp"?
man hat doch oben schon die variable "cmd" mit dem gleichen wert definiert.
also warum funktioniert dann z. b. "giveplayerid=strval(cmd)"(zeile 11) nicht und warum muss es stattdessen "strval(tmp)" sein?