AdminOnDuty display at /admins
#1

Hello all. I have a quick question regarding showing OnDuty or nothing if not on duty as an admin.

Basically what I want to do is if someone does /admins and an admin is on duty it should be like this:

Name_Lastname OnDuty/ReadyToHelp

And if hes not on duty it should say OffDuty instead.

Here is the code I tried to work on, it compiles and goes through but ingame it doesnt display OffDuty or OnDuty

pawn Code:
new adminduty[64];
if(PlayerInfo[i][pAdminDuty] == 0)
{
adminduty = "OffDuty";
}
else if(PlayerInfo[i][pAdminDuty] == 1)
{
adminduty ="OnDuty/ReadyToHelp";
}
pawn Code:
format(string, sizeof(string), "[%s]: %s *[%s]*", atext, PlayerName(i), adminduty);
SendClientMessage(playerid, COLOR_WHITE, string);
Reply
#2

Well, you can use something like this:

pawn Code:
stock AdminDuty(playerid)
{
    new AdminDuty[32];
    if(PlayerInfo[playerid][pAdminDuty] == 0) format(AdminDuty, sizeof(AdminDuty), "OffDuty");
    else if(PlayerInfo[playerid][pAdminDuty] == 1) format(AdminDuty, sizeof(AdminDuty), "OnDuty/ReadyToHelp");
    return AdminDuty;
}
And after writing that somewhere on your script, you go over the 'OnPlayerText' or wherever you want to use it and do this:

pawn Code:
format(string, sizeof(string), "[%s]: %s *[%s]*", atext, PlayerName(i), AdminDuty);
SendClientMessage(playerid, COLOR_WHITE, string);
This shall be fine.

Tell me if it works or either not.

EDIT: I saw this '[%s]: %s *[%s]*, atext', you're using text before name, are you sure about that? It's going to be like "Hello server: Private200 *[OnDuty]*". Change the places to fix it like this:

pawn Code:
format(string, sizeof(string), "[%s]: %s *[%s]*", PlayerName(i), atext, AdminDuty);
SendClientMessage(playerid, COLOR_WHITE, string);
Reply
#3

Thank you for your reply, I will test it out and come back to you

atext = Admin Ranks. This is for /admins only not for a chat system :- )
Reply
#4

Well, it's either same. Put the code into your '/admins' command.

I've made an problem on the script first I wrote, make this changes on it:

pawn Code:
stock AdminDuty(playerid)
{
    new AdminDuty[32];
    if(PlayerInfo[playerid][pAdminDuty] == 0) format(AdminDuty, sizeof(AdminDuty), "OffDuty");
    else if(PlayerInfo[playerid][pAdminDuty] == 1) format(AdminDuty, sizeof(AdminDuty), "OnDuty/ReadyToHelp");
    return AdminDuty;
}
Reply
#5

Having these two errors:

C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(62395) : error 029: invalid expression, assumed zero
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(62395) : error 001: expected token: ";", but found "if"

Line 62395:

else if(PlayerInfo[i][pAdminDuty] == 1) format(adminduty, sizeof(adminduty), "OnDuty/ReadyToHelp");
Reply
#6

pawn Code:
stock AdminDuty(playerid)
{
    new AdminDuty[32];
    if(PlayerInfo[playerid][pAdminDuty] == 0) format(AdminDuty, sizeof(AdminDuty), "OffDuty");
    else if(PlayerInfo[playerid][pAdminDuty] == 1) format(AdminDuty, sizeof(AdminDuty), "OnDuty/ReadyToHelp");
    return AdminDuty;
}
Change the old stock to this one, and it shall work fine.
Reply
#7

Gave me lots of errors when using return at the bottom of the code, hmm.
Reply
#8

Using this:
pawn Code:
new adminduty[64];
if(PlayerInfo[i][pAdminDuty] == 0)
{
adminduty = "OffDuty";
}
else if(PlayerInfo[i][pAdminDuty] == 1)
{
adminduty ="OnDuty/ReadyToHelp";
}
It shows OffDuty even though Im on duty as an admin...

Your code doesn't work.
Reply
#9

Well, try to change the 'return AdminDuty;' to 'return 1;' instead.

The code you gave wont work, try to use the one I gave you.
Reply
#10

Here is your code tho..

C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59073) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59074) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59075) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59076) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59080) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59081) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59082) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59083) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59084) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59085) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59086) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59087) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(5908 : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59089) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59090) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59091) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59092) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59093) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59094) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59095) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59096) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59097) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59099) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59100) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59101) : error 079: inconsistent return types (array & non-array)
C:\Infinity Gaming Roleplay Server\gamemodes\U-RP.pwn(59103) : error 079: inconsistent return types (array & non-array)

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


26 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)