/ask -
antonisrodos94 - 30.04.2012
i need commant /ask and type and go message admin can help me?
Re: /ask -
Mean - 30.04.2012
Your admin level variable is..? Simply, how do you check if a player is admin in your commands?
Re: /ask -
FalconX - 30.04.2012
Quote:
Originally Posted by antonisrodos94
i need commant /ask and type and go message admin can help me?
|
You could do like this, if you want a player to have ability to send a message to admins:-
pawn Код:
COMMAND:ask(playerid, params[])
{
new Fstring[164], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(sscanf(params, "s[128]", Fstring))
{
SendClientMessage(playerid, -1, "ERROR: Usage /ask [message]");
return 1;
}
else
{
for(new f = 0; f < MAX_PLAYERS; f++)
{
if(IsPlayerConnected(f))
{
if(IsPlayerAdmin(f)) // you could change into your own admin system
{
format(Fstring, sizeof(Fstring), "(PM TO ADMINS) %s: %s ", name, Fstring);
SendClientMessage(f, -1, Fstring);
}
}
}
}
return 1;
}
Give it a try and tell me if it works.
-FalconX
Re: /ask -
antonisrodos94 - 30.04.2012
2 error can fix?
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6602) : error 017: undefined symbol "ask"
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6606) : error 017: undefined symbol "sscanf"
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6634) : warning 225: unreachable code
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6602) : warning 203: symbol is never used: "COMMAND"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Re: /ask -
Mean - 30.04.2012
pawn Код:
if(!strcmp(cmdtext, "/ask", true, 4)) {
new str[128], pName[24];
GetPlayerName(playerid, pName, 24);
format(str, sizeof str, "%s asked: %s", pName, cmdtext[5]);
for(new i=0; i<MAX_PLAYERS;++i) {
if(IsPlayerAdmin(i)) { // You might need your alevel variable if you're using an admin script!
SendClientMessage(i, -1, str);
}
}
return 1;
}
Re: /ask -
antonisrodos94 - 30.04.2012
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6603) : warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
can i fix this warning?
Re: /ask -
Mark™ - 30.04.2012
Quote:
Originally Posted by antonisrodos94
C:\Users\antonis\Desktop\serverffs arxia\gamemode\Freeroam.pwn(6603) : warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
can i fix this warning?
|
Change the name of the variable, make it "pname" instead of "pName".pName is already created somewhere in your script that's why it's warning you for duplicity.
Re: /ask -
newbienoob - 30.04.2012
It should be pName[MAX_PLAYER_NAME]
Re: /ask -
antonisrodos94 - 30.04.2012
Thanks all for Help!!
Re: /ask -
Mean - 30.04.2012
Quote:
Originally Posted by newbienoob
It should be pName[MAX_PLAYER_NAME]
|
No, MAX_PLAYER_NAME equals 24 so it's the same.
pName[MAX_PLAYER_NAME] is the same as pName[24].
From a_samp.inc:
pawn Код:
#define MAX_PLAYER_NAME (24)