[Help] /helpme System. - 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: [Help] /helpme System. (
/showthread.php?tid=285120)
[Help] /helpme System. -
DanTzi - 22.09.2011
Can someone explain me how can I make a simple helpers system and /helpme command?
Re: [Help] /helpme System. -
Fat - 22.09.2011
You need to first of all, script the helper variable in the playerinfo enum, or what ever you've scripted.
Then, you need to make a /makehelper command, which is good IMO.
Then, you can do a /helpme command, that will send a message to all players.
Here's the /askq from my script, same as /helpme.
pawn Код:
if(strcmp(cmd, "/askq", true) == 0) {
if(IsPlayerConnected(playerid)) {
if(Mute[playerid] == 1) {
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You can't speak, you have been silenced !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) {
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) {
SendClientMessage(playerid, COLOR_GRAD2, "[{EE5555}USAGE{FFFFFF}]: /askq [text]");
return 1;
}
format(string, sizeof(string), "Question from %s ID:[%i]: %s", sendername, playerid, (result));
SendHelperMessage(COLOR_ASKQ, string);
SendAdminMessage(COLOR_ASKQ, string);
SendClientMessage(playerid, COLOR_GREEN, "Your question has been sent to all online supporters.");
}
return 1;
}
My SendHelperMessage function :
pawn Код:
forward SendHelperMessage(color, string[]);
public SendHelperMessage(color, string[])
{
foreach (Player,i) {
if(gPlayerLogged[i] == 1) {
if(PlayerInfo[i][pHelper] == 1) {
SendClientMessage(i, color, string);
}
}
}
}