Reports Questions Send only for DutyOn Admins? -
ServerScripter - 04.10.2011
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) == 0 || strcmp(cmd, "/aod", true) == 0 || strcmp(cmd, "/aduty", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You are not Connected !");
return 1;
}
if(PlayerInfo[playerid][pAdmin] > 0)
{
if(AdminDuty[playerid] == 0)
{
AdminDuty[playerid] = 1;
SetPlayerArmour(playerid, 999);
SetPlayerHealth(playerid, 999);
SetPlayerColor(playerid, COLOR_LIGHTRED);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[DUTY] %s Is now OnDuty", sendername);
ABroadCast(COLOR_LIGHTRED,string,1);
if(PlayerInfo[playerid][pAdmin] >= 1339)
SafeGivePlayerWeapon(playerid, 38, 11000);
{
for(new i = 0; i < sizeof(CarInfo); i++)
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
else if(AdminDuty[playerid] == 1)
{
AdminDuty[playerid] = 0;
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, 100);
SafeResetPlayerWeapons(playerid);
SetPlayerColor(playerid,COLOR_WHITE);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[DUTY] %s Is OffDuty", sendername);
ABroadCast(COLOR_LIGHTRED,string,1);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_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(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /report [ID] [Reason]");
return 1;
}
giveplayerid = strval(tmp);
GetPlayerName(giveplayerid, giveplayer, sizeof(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(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;
}
Thanks .
Re: Reports Questions Send only for DutyOn Admins? -
Pharrel - 04.10.2011
show us the public ABroadCast...
Re: Reports Questions Send only for DutyOn Admins? -
ServerScripter - 04.10.2011
PHP Code:
public ABroadCast(color,const string[],level)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (PlayerInfo[i][pAdmin] >= level)
{
SendClientMessage(i, color, string);
printf("%s", string);
}
}
}
return 1;
}
Re: Reports Questions Send only for DutyOn Admins? -
Pharrel - 04.10.2011
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;
}
Re: Reports Questions Send only for DutyOn Admins? -
ServerScripter - 04.10.2011
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.
Re: Reports Questions Send only for DutyOn Admins? -
Pharrel - 04.10.2011
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...
Re: Reports Questions Send only for DutyOn Admins? -
ServerScripter - 05.10.2011
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" .