Slap Command - 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)
+--- Thread: Slap Command (
/showthread.php?tid=350638)
Re: Slap Command -
iThePunisher - 16.03.2014
add this at the end of your script
pawn Code:
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, Name, sizeof(Name));
}
return Name;
}
EDIT: didn't noticed that @vince already told u
Re: Slap Command -
Greaper - 16.03.2014
Re: Slap Command - Guest4390857394857 - 16.03.2014
Under onplayercommandtext
PHP Code:
dcmd(slap, 4, cmdtext);
ANd this is the code!
Code:
dcmd_slap(playerid, params[])
{
new id, string[126], Float: PPos[3];
if(sscanf(params, "u", id))
return SendClientMessage(playerid, -1, "SYNTAX: /slap [id]");
GetPlayerPos(id, PPos[0], PPos[1], PPos[2]);
SetPlayerPos(id, PPos[0], PPos[1], PPos[2]+4);
format(string, sizeof(string), "You have slapped %s", GetName(id));
SendClientMessage(playerid, -1, string);
return 1;
}
And add this somewhere last!
PHP Code:
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, Name, sizeof(Name));
}
return Name;
}
Salute Indian, i'm also indian!If worked , rep me bro!