How can you create a /apm
#5

pawn Код:
CMD:apm(playerid, params[]) // Name of CMD apm
{
if(PlayerInfo[playerid][pAdmin] /*your enum could be different!*/ == 0) return SendClientMessage(playerid, COLOR, "You are not authorized to use this command!"); // If the player is NOT an admin, send him a message saying he can't use them
new strsend[130], targetid; // strsend is a string that stores the message the player types in the parameters, targetid is the id of the player that the admin will send the message to
if(sscanf(params, "us", targetid, strsend)) return SendClientMessage(playerid, COLOR, "Usage: /apm [playerid] [Message]"); // Check with sscanf if the player has used the command correctly, if he hasn't, show him how to
if(targetid == playerid) return SendClientMessage(playerid, COLOR, "You cannot message yourself!");
new str[35], name[MAX_PLAYER_NAME]; // MAX_PLAYER_NAME is he max characters that can be put in any SA:MP Name, name is the string which saves the name of the player, str is the string that will have the format of the message itself
GetPlayerName(playerid, name, sizeof(name)); // Save Admin's name in string "name"
format(str, sizeof(strsend), "Admin %s Says: %s", name, strsend); //Format of the message that will be sent to the Player, which will be saved in str
SendClientMessage(targetid, COLOR, str); // Send The Message to the player.
GetPlayerName(targetid, name, sizeof(name)); // Save the Player's name in string "name"
format(str, sizeof(strsend), "APM Sent to %s: %s", name, strsend); // Format of the message that will be sent to the Admin, which will be saved in str
SendClientMessage(playerid, COLOR, str); // Send Message to admin
return 1;
} // By: Elie1996
Reply


Messages In This Thread
How can you create a /apm - by lulo356 - 28.10.2013, 12:33
Re: How can you create a /apm - by Dolby - 28.10.2013, 12:35
Re: How can you create a /apm - by Konstantinos - 28.10.2013, 13:07
Re: How can you create a /apm - by Brandon_More - 28.10.2013, 16:14
Re: How can you create a /apm - by Elie1996 - 11.11.2013, 20:15
Re: How can you create a /apm - by BodyBoardVEVO - 11.11.2013, 20:25

Forum Jump:


Users browsing this thread: 2 Guest(s)