Reports Questions Send only for DutyOn Admins?
#1

Hello , i have no Idea how to Make that: The Reports are send only for DutyOn Admins.
this is /adminduty Command:
PHP Code:
if(strcmp(cmd"/adminduty"true) == || strcmp(cmd"/aod"true) == || strcmp(cmd"/aduty"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
gPlayerLogged[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"You are not Connected !");
                return 
1;
            }
            if(
PlayerInfo[playerid][pAdmin] > 0)
            {
                if(
AdminDuty[playerid] == 0)
                {
                    
AdminDuty[playerid] = 1;
                    
SetPlayerArmour(playerid999);
                    
SetPlayerHealth(playerid999);
                    
SetPlayerColor(playeridCOLOR_LIGHTRED);
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
format(stringsizeof(string), "[DUTY] %s Is now OnDuty"sendername);
                    
ABroadCast(COLOR_LIGHTRED,string,1);
                    if(
PlayerInfo[playerid][pAdmin] >= 1339)
                    
SafeGivePlayerWeapon(playerid3811000);
                    {
                        for(new 
0sizeof(CarInfo); i++)
                        {
                            
SetVehicleParamsForPlayer(i,playerid,0,0);
                        }
                    }
                    return 
1;
                }
                else if(
AdminDuty[playerid] == 1)
                {
                    
AdminDuty[playerid] = 0;
                    
SetPlayerArmour(playerid0);
                    
SetPlayerHealth(playerid100);
                    
SafeResetPlayerWeapons(playerid);
                    
SetPlayerColor(playerid,COLOR_WHITE);
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
format(stringsizeof(string), "[DUTY] %s Is OffDuty"sendername);
                    
ABroadCast(COLOR_LIGHTRED,string,1);
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_BLUE"You Can Not do that");
                return 
1;
            }
        }
        return 
1;
    } 
And this is Report command:
PHP Code:
if(strcmp(cmd"/report"true) == 0
    {
    if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /report [ID] [Reason]");
                return 
1;
            }
            
giveplayerid strval(tmp);
            
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
            if(
IsPlayerConnected(giveplayerid))
            {
                if(
giveplayerid != INVALID_PLAYER_ID)
                {
                       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(playeridCOLOR_GRAD2"USAGE: /report [ID of the Player] [Reason]");
                        return 
1;
                    }
                     
format(stringsizeof(string), "%s (%d) reported %s (%d)Reason: %s",sendernameplayeridgiveplayergiveplayerid, (result));
                    
ABroadCast(COLOR_LIGHTRED,string,1);
                    
SendClientMessage(playeridCOLOR_YELLOW"Your Rapport Was Send to Online Admins.");
                }
               }
               else
            {
                
SendClientMessage(playeridCOLOR_GREY"This Player isn't Connected !");
                return 
1;
            }
        }
        return 
1;
    } 
Thanks .
Reply
#2

show us the public ABroadCast...
Reply
#3

PHP Code:
public ABroadCast(color,const string[],level)
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if (
PlayerInfo[i][pAdmin] >= level)
            {
                
SendClientMessage(icolorstring);
                
printf("%s"string);
            }
        }
    }
    return 
1;

Reply
#4

pawn Code:
if(strcmp(cmd, "/report", true) == 0)
    {
    if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /report [ID] [Reason]");
                return 1;
            }
            giveplayerid = strval(tmp);
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            if(AdminDuty[giveplayerid] == 0) return SendClientMessage(playerid, -1, "This admin isnt onduty!");
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                       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, "USAGE: /report [ID of the Player] [Reason]");
                        return 1;
                    }
                     format(string, sizeof(string), "%s (%d) reported %s (%d)Reason: %s",sendername, playerid, giveplayer, giveplayerid, (result));
                    ABroadCast(COLOR_LIGHTRED,string,1);
                    SendClientMessage(playerid, COLOR_YELLOW, "Your Rapport Was Send to Online Admins.");
                }
               }
               else
            {
                SendClientMessage(playerid, COLOR_GREY, "This Player isn't Connected !");
                return 1;
            }
        }
        return 1;
    }
Reply
#5

Code:
C:\Documents and Settings\PC\Bureau\CMVA\pawno\include\YSI/y_ini.inc(416) : warning 219: local variable "f" shadows a variable at a preceding level
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(22314) : warning 219: local variable "f" shadows a variable at a preceding level
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(22390) : warning 219: local variable "f" shadows a variable at a preceding level
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(25041) : error 017: undefined symbol "f"
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(25089) : warning 225: unreachable code
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(71180) : warning 219: local variable "f" shadows a variable at a preceding level
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(71252) : warning 219: local variable "f" shadows a variable at a preceding level
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(71387) : warning 219: local variable "f" shadows a variable at a preceding level
C:\DOCUME~1\PC\Bureau\CMVA\GAMEMO~1\CMVA.pwn(71478) : warning 219: local variable "f" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

i just add this ->
pawn Code:
if(AdminDuty[giveplayerid] == 0) return SendClientMessage(playerid, -1, "This admin isnt onduty!");
in your command so the problem isnt there...
Reply
#7

Fixed

The Problem was here :
Code:
f(strcmp(cmd, "/report", true) == 0)
Must be
Code:
if(strcmp(cmd, "/report", true) == 0)
i Forgot the "i" for "if" .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)