SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/05/2013, 06:00 AM   #1
Fell
Little Clucker
 
Join Date: Apr 2013
Location: Norway
Posts: 35
Reputation: 2
Default AdminOnDuty display at /admins

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);
Fell is offline   Reply With Quote
Old 11/05/2013, 06:08 AM   #2
Private200
High-roller
 
Private200's Avatar
 
Join Date: May 2012
Posts: 1,176
Reputation: 211
Default Re: AdminOnDuty display at /admins

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);
Private200 is offline   Reply With Quote
Old 11/05/2013, 06:16 AM   #3
Fell
Little Clucker
 
Join Date: Apr 2013
Location: Norway
Posts: 35
Reputation: 2
Default Re: AdminOnDuty display at /admins

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 :- )
Fell is offline   Reply With Quote
Old 11/05/2013, 06:26 AM   #4
Private200
High-roller
 
Private200's Avatar
 
Join Date: May 2012
Posts: 1,176
Reputation: 211
Default Re: AdminOnDuty display at /admins

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;
}
Private200 is offline   Reply With Quote
Old 11/05/2013, 06:29 AM   #5
Fell
Little Clucker
 
Join Date: Apr 2013
Location: Norway
Posts: 35
Reputation: 2
Default Re: AdminOnDuty display at /admins

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");
Fell is offline   Reply With Quote
Old 11/05/2013, 06:30 AM   #6
Private200
High-roller
 
Private200's Avatar
 
Join Date: May 2012
Posts: 1,176
Reputation: 211
Default Re: AdminOnDuty display at /admins

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.
Private200 is offline   Reply With Quote
Old 11/05/2013, 06:37 AM   #7
Fell
Little Clucker
 
Join Date: Apr 2013
Location: Norway
Posts: 35
Reputation: 2
Default Re: AdminOnDuty display at /admins

Gave me lots of errors when using return at the bottom of the code, hmm.
Fell is offline   Reply With Quote
Old 11/05/2013, 07:17 AM   #8
Fell
Little Clucker
 
Join Date: Apr 2013
Location: Norway
Posts: 35
Reputation: 2
Default Re: AdminOnDuty display at /admins

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.
Fell is offline   Reply With Quote
Old 11/05/2013, 07:23 AM   #9
Private200
High-roller
 
Private200's Avatar
 
Join Date: May 2012
Posts: 1,176
Reputation: 211
Default Re: AdminOnDuty display at /admins

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.
Private200 is offline   Reply With Quote
Old 11/05/2013, 07:59 AM   #10
Fell
Little Clucker
 
Join Date: Apr 2013
Location: Norway
Posts: 35
Reputation: 2
Default Re: AdminOnDuty display at /admins

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 (c) 1997-2006, ITB CompuPhase


26 Errors.
Fell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making it work both Admins and Rcon Admins JaKe Elite Scripting Help 7 31/05/2012 12:57 PM
/admins dialog Total online admins do help:( y@sin1 Scripting Help 10 14/01/2012 03:58 PM
[HELP]/admins <Show current admins online by ID, Name, Rank and Duty> Deal-or-die Help Archive 7 01/06/2011 11:00 AM
How do I make level 1 admins secret from /admins seanny Help Archive 4 27/05/2011 08:00 AM
Display Mrkrabz Everything and Nothing 2 13/09/2010 06:01 PM


All times are GMT. The time now is 05:01 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.