SA-MP Forums Archive
Help with /aduty and /helpme - 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 with /aduty and /helpme (/showthread.php?tid=289127)



Help with /aduty and /helpme - Azzeto - 10.10.2011

EDIT: I think i'v fixed it,
pawn Код:
CMD:aduty(playerid,params[]){
    new string[128];
    if(PlayerInfo[playerid][pAdminDuty] == 0)
    format(string,sizeof(string),"%s has just went on Admin Duty",GetName(playerid));
    SendClientMessageToAll(COLOR_GREEN,string);
    SetPlayerHealth(playerid,500000);
    SetPlayerColor(playerid,COLOR_CYAN);
    Player[playerid][pAdminDuty] = 1;
    }
    else
    {
    if(PlayerInfo[playerid][pAdminDuty] == 1)
    format(string,sizeof(string),"%s has just went off admin duty!");
    SendClientMessageToAll(playerid,COLOR_RED,string);
    Player[playerid][pAdminDuty] = 0;
    }
    return 1;
}
But I get four errors.. I think its because the else part.
Код:
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(707) : error 017: undefined symbol "Player"
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(707) : warning 215: expression has no effect
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(707) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(707) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(707) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
But how would I Send a message to an Admin if hes on duty? And not to normal players


Re: Help with /aduty and /helpme - [GOD]Dragonster82 - 10.10.2011

SendClientMessage(playerid, YOURCOLOR, "MESSAGE"); for your question

The errors are because you didn't add another bracket at the end.


Re: Help with /aduty and /helpme - Azzeto - 10.10.2011

Could you show where I didnt add the bracket? Im confused
And I know "SendClientMessage" but I need it to send to the ADMINS ONLY.


Re: Help with /aduty and /helpme - [GOD]Dragonster82 - 10.10.2011

Not tested, because i don't know your admin system, but this should work
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
{
 if(PlayerInfo[playerid][pAdminLevel] >= 1)
{
 SendClientMessage(i, COLOR, "YOURMESSAGE");
Btw, I don't recommend you to use your current /aduty thing, because it doesn't detects if you are a admin or not, it just puts you on duty regardless of the rank


Re: Help with /aduty and /helpme - Azzeto - 10.10.2011

And what about the bracket? I get three errors now.
code
pawn Код:
CMD:aduty(playerid,params[]){
    new string[128];
    if(PlayerInfo[playerid][pAdmin] > 1) return SendClientMessage(playerid,COLOR_GRAY,"You're not an admin!");
    if(PlayerInfo[playerid][pAdminDuty] == 0)
    format(string,sizeof(string),"%s has just went on Admin Duty",GetName(playerid));
    SendClientMessageToAll(COLOR_GREEN,string);
    SetPlayerHealth(playerid,500000);
    SetPlayerColor(playerid,COLOR_CYAN);
    PlayerInfo[playerid][pAdminDuty] = 1;
    }
    else
    {
    if(PlayerInfo[playerid][pAdminDuty] == 1)
    format(string,sizeof(string),"%s has just went off admin duty!");
    SendClientMessageToAll(playerid,COLOR_RED,string);
    Player[playerid][pAdminDuty] = 0;
    }
    return 1;
    }
}
Код:
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(709) : warning 209: function "cmd_aduty" should return a value
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(710) : error 010: invalid function or declaration
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(712) : error 010: invalid function or declaration
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(717) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.



Re: Help with /aduty and /helpme - [GOD]Dragonster82 - 10.10.2011

For the 1st error:
pawn Код:
}
    // REMOVE IT return 1;
    }
    return 1;
}
Can you show me the where the rest of the errors are? It would be a great help.


Re: Help with /aduty and /helpme - Azzeto - 10.10.2011

Error 711:
pawn Код:
else
Error 713:
pawn Код:
if(PlayerInfo[playerid][pAdminDuty] == 1)
Error 718:
pawn Код:
return 1;
Could you like copy & paste my command the fixed way with commenting what you fixed so I can see and learn from it?


Re: Help with /aduty and /helpme - [GOD]Dragonster82 - 10.10.2011

Go and get msn, we'll chat there.
Its pretty hard to explain here.


Re: Help with /aduty and /helpme - Azzeto - 10.10.2011

I'm on my MSN, Azzeto@live.com


Re: Help with /aduty and /helpme - GrimR - 10.10.2011

Try this mate:

pawn Код:
CMD:aduty(playerid, params[])
{
  new string[128];
  new uName[128];
 
  GetPlayerName(playerid, uName, sizeof(uName));
   
  if(PlayerInfo[playerid][pAdmin] < 1) { return SendClientMessage(playerid, COLOR_GRAY, "You're not an admin!"); }
  if(PlayerInfo[playerid][pAdminDuty] == 0)
  {
    format(string, sizeof(string), "%s has just went on Admin Duty", uName);
    SendClientMessageToAll(COLOR_GREEN, string);
    SetPlayerHealth(playerid, 500000);
    SetPlayerColor(playerid, COLOR_CYAN);
    PlayerInfo[playerid][pAdminDuty] = 1;
  }
  else if (PlayerInfo[playerid][pAdminDuty] == 1)
  {
    format(string, sizeof(string), "%s has just went off admin duty!", uName);
    SendClientMessageToAll(playerid, COLOR_RED, string);
    Player[playerid][pAdminDuty] = 0;
  }
 
  return 1;
}