01.08.2006, 08:50
-Bump-
I liked the topic, its a shame that people dont post any new cmd\'s, so I\'ll do .
Here\'s my working slap-command, if you want to use it you also need to paste the strtok function in your script. Also define the COLOR_PINK and COLOR_WHITE on top of your script.
Have fun .
I liked the topic, its a shame that people dont post any new cmd\'s, so I\'ll do .
Here\'s my working slap-command, if you want to use it you also need to paste the strtok function in your script. Also define the COLOR_PINK and COLOR_WHITE on top of your script.
Have fun .
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new adminname[256];
new playername[256];
new id;
new tmp[256];
new cmd[256];
new Float:health, Float:x, Float:y, Float:z;
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/slap", true) == 0 && IsPlayerAdmin(playerid)==1) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "Usage: /slap <playerid>");
return 1;
}
if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "You haven\'t got any admin rights");
return 1;
}
id = strval(tmp);
if(IsPlayerConnected(id)) {
GetPlayerPos(id, x, y, z);
PlayerPlaySound(id, 1190, x, y, z);
SetPlayerPos(id, x, y, z+2);
GetPlayerHealth(id, health);
SetPlayerHealth(id, health-10);
GetPlayerName(id, playername, 256);
GetPlayerName(playerid, adminname, 256);
format(string, sizeof(string), "%s slaps %s with a large fish!! /*You can also add some other text here to your likings..*/", adminname, playername);
SendClientMessageToAll(COLOR_PINK, string);
/*format(string, sizeof(string), "%s slapped you!!", adminname);
SendClientMessage(id, COLOR_WHITE, string);*/
}
else {
format(string, sizeof(string), "%d is not an active player.", id);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
return 0;
}