A little 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)
+--- Thread: A little help (
/showthread.php?tid=511861)
A little help -
Johnson_Brooks - 07.05.2014
I've been away from coding for a year or two and i've forgot a few things but ill catch up

I would like someone to tell me how to create an /admin [question] command
What it does ?
It sends a questions to online admins and they can answer with a /reply [id] [response] to him .
NOTE: All admins can see it .
I would only like the commands , i will make the admin only .
And a /report command that saves into reports.txt
I know its too much but i really need those.
Re: A little help -
Nathan_Taylor - 07.05.2014
/admin [question] command using ZCMD & SSCANF2
pawn Код:
CMD:admin(playerid, params[])
{
new string[128];
new sName[MAX_PLAYER_NAME];
if(sscanf(params, "s", string)) return SendClientMessage(playerid, -1, "Usage /admin [question]");
GetPlayerName(playerid, sName, sizeof(sName));
new Message[128];
format(Message, sizeof(Message), "QUESTION from %s: %s", sName, string);
for(new i; i < MAX_PLAYERS; i++){
//if(IsPlayerAdmin(i)){
SendClientMessage(i, -1, Message);
//}
}
return 1;
}
/reply
pawn Код:
CMD:reply(playerid, params[])
{
//if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You don't have permission to use this command");
new
to,
message[128],
aName[MAX_PLAYER_NAME];
GetPlayerName(playerid, aName, sizeof(aName));
if(sscanf(params, "is", to, string)) return SendClientMessage(playerid, -1, "Usage /reply [id] [response]");
if(!IsPlayerConnected(to)) return SendClientMessage(playerid, -1, "Player is not online");
format(message, sizeof(message), "Response from %s: %s", aName, message);
SendClientMessage(to, -1, message);
return 1;
}
Re: A little help -
Johnson_Brooks - 07.05.2014
Quote:
Originally Posted by Nathan_Taylor
/admin [question] command using ZCMD & SSCANF2
pawn Код:
CMD:admin(playerid, params[]) { new string[128]; new sName[MAX_PLAYER_NAME]; if(sscanf(params, "s", string)) return SendClientMessage(playerid, -1, "Usage /admin [question]"); GetPlayerName(playerid, sName, sizeof(sName)); new Message[128]; format(Message, sizeof(Message), "QUESTION from %s: %s", sName, string); for(new i; i < MAX_PLAYERS; i++){ //if(IsPlayerAdmin(i)){ SendClientMessage(i, -1, Message); //} } return 1; }
/reply
pawn Код:
CMD:reply(playerid, params[]) { //if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You don't have permission to use this command"); new to, message[128], aName[MAX_PLAYER_NAME]; GetPlayerName(playerid, aName, sizeof(aName)); if(sscanf(params, "is", to, string)) return SendClientMessage(playerid, -1, "Usage /reply [id] [response]"); if(!IsPlayerConnected(to)) return SendClientMessage(playerid, -1, "Player is not online"); format(message, sizeof(message), "Response from %s: %s", aName, message); SendClientMessage(to, -1, message); return 1; }
|
Thanks . +rep for the help
Re: A little help -
Nathan_Taylor - 07.05.2014
Quote:
Originally Posted by Johnson_Brooks
Thanks . +rep for the help 
|
Not a problem