SA-MP Forums Archive
how to make a slap - 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: how to make a slap (/showthread.php?tid=395381)



how to make a slap - DerickClark - 26.11.2012

how to make a /slap command?


Re: how to make a slap - Threshold - 26.11.2012

Quote:

cmd_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);

new GetName[MAX_PLAYER_NAME]
GetPlayerName(playerid, GetName, sizeof(GetName));
format(string, sizeof(string), "You have slapped %s", GetName(id));
SendClientMessage(playerid, -1, string);
return 1;
}

There ya go!


Re: how to make a slap - Scenario - 26.11.2012

You need to retrieve their current position using GetPlayerPos.

Then you need to use their position and increase the Z coordinate by 5, then set their position using SetPlayerPos.