lil help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: lil help (
/showthread.php?tid=244588)
lil help -
tanush - 27.03.2011
when i akill my self it shows the player that is id0 killed me for example imagine im id1 name:tanush and id0 name:killa. it will show Killa has admin killed you when i did /akill 1
pawn Код:
COMMAND:akill(playerid, params[])
{
if(PlayerData[playerid][AdminLevel] > 1)
{
new id,str[128],name[MAX_PLAYER_NAME],oname[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(id,oname,sizeof(oname));
if(sscanf(params, "ui", id)) return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /akill [id]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "That user is not connected.");
format(str,sizeof(str),"Administrator %s has admin killed you!",oname);
SendClientMessage(id,0xFF9900AA,str);
format(str,sizeof(str),"You had admin killed %s!",oname);
SendClientMessage(playerid,0xFF9900AA,str);
return SetPlayerHealth(id,0);
}
else return SendClientMessage(playerid,0xFF0000FF, "ERROR: Your admin level isn't high enough!");
}
Re: lil help -
Cameltoe - 27.03.2011
You are getting the Players name before processing it through sscanf.
Re: lil help -
mprofitt - 27.03.2011
Код:
OnPlayerDeath
if killer == INVALID_PLAYER_ID
sendclientmessagetoall "player commited suicide"
else
player X killed Player Y
Re: lil help -
xir - 27.03.2011
Hm can you try this?
pawn Код:
COMMAND:akill(playerid, params[])
{
if(PlayerData[playerid][AdminLevel] > 1)
{
new id,str[128],name[MAX_PLAYER_NAME],oname[MAX_PLAYER_NAME];
if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /akill [id]");
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(id,oname,sizeof(oname));
if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000FF, "That user is not connected.");
format(str,sizeof(str),"Administrator %s has admin killed you!",name);
SendClientMessage(id,0xFF9900AA,str);
format(str,sizeof(str),"You had admin killed %s!",oname);
SendClientMessage(playerid,0xFF9900AA,str);
return SetPlayerHealth(id,0);
}
else return SendClientMessage(playerid,0xFF0000FF, "ERROR: Your admin level isn't high enough!");
}