PDA

View Full Version : /report cmd


Boss201
04/12/2013, 11:11 AM
CMD:report(playerid,params[])
{
new string[128], id, reason[35];
if(sscanf(params,"us[35]",id,reason)) return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /report [id] [reason]");
if(id == INVALID_PLAYER_ID)) return SendClientMessage(playerid, COLOR_GRAY, "ERROR: Player is not connected!");
format(string,sizeof(string),"%s has reported %s: %s",GetName(playerid),GetName(id),reason);
SendToAdmins(COLOR_YELLOW,string);
return 1;
}

1 ERROR = Undefined symbol "SendToAdmins"

this is my enum
enum PlayerInfo
{
Pass[129],
pAdminLevel,
VIPlevel,
Money,
Scores,
Kills,
Deaths

}

i asked someone he said make a stock for SendToAdmins

i dont know how to make it can some one help me

thanks.

gotwarzone
04/12/2013, 11:18 AM
1 ERROR = Undefined symbol "SendToAdmins"

this is my enum
enum PlayerInfo
{
Pass[129],
pAdminLevel,
VIPlevel,
Money,
Scores,
Kills,
Deaths

}

i asked someone he said make a stock for SendToAdmins

i dont know how to make it can some one help me

thanks.

on top of your script or together with the forwards.
forward SendToAdmins(color,const string[]);



public SendToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if((IsPlayerNPC(i)) || (!IsPlayerConnected(i))) continue;
if((PlayerInfo[i][pAdminLevel] >= 1)) SendClientMessage(i, color, string);
}
return 1;
}


CMD:report(playerid,params[])
{
new string[128], id, reason[35];
if(sscanf(params,"us[35]",id,reason)) return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /report [id] [reason]");
if(id == INVALID_PLAYER_ID)) return SendClientMessage(playerid, COLOR_GRAY, "ERROR: Player is not connected!");
format(string,sizeof(string),"%s has reported %s: %s",GetName(playerid),GetName(id),reason);
SendToAdmins(COLOR_YELLOW,string);
return 1;
}

TahaAsif12
04/12/2013, 11:18 AM
Can u show the SendToId function?

Boss201
04/12/2013, 11:38 AM
gotwarzone i used your code and i got 4 errors

C:\Users\pc\Desktop\Scratch\Scripting Data\gamemodes\Gamemode.pwn(179) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
C:\Users\pc\Desktop\Scratch\Scripting Data\gamemodes\Gamemode.pwn(179) : error 029: invalid expression, assumed zero
C:\Users\pc\Desktop\Scratch\Scripting Data\gamemodes\Gamemode.pwn(179) : error 029: invalid expression, assumed zero
C:\Users\pc\Desktop\Scratch\Scripting Data\gamemodes\Gamemode.pwn(179) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


line 179= if((PlayerInfo[i][pAdminLevel] >= 1)) SendClientMessage(i, color, string);

gotwarzone
04/12/2013, 11:45 AM
Can you please show 1 admin command like /slap or /burn

Boss201
04/12/2013, 11:47 AM
CMD:aslap(playerid,params[])
{
new targetid,height;
if(pInfo[playerid][pAdminLevel] < 1) return 0;
if(sscanf(params,"uI(10)",targetid,height)) return SendClientMessage(playerid,-1,"USAGE : /slap [id] [height]");
if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Player not connected || Invalid Id");
new Float:pos[3];
GetPlayerPos(targetid,pos[0],pos[1],pos[2]);
SetPlayerPos(targetid,pos[0],pos[1],pos[2] + height);
new msg[128];
new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,24);
GetPlayerName(targetid,tName,24);
format(msg,sizeof(msg),"%s(%d) slapped %s(%d)",pName,playerid,tName,targetid);
SendClientMessageToAll(-1,msg);
return 1;
}

gotwarzone
04/12/2013, 11:49 AM
Replaced the old one


public SendToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if((IsPlayerNPC(i)) || (!IsPlayerConnected(i))) continue;
if((PlayerInfo[i][pAdminLevel] >= 1)) SendClientMessage(i, color, string);
}
return 1;
}



to this


public SendToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if((IsPlayerNPC(i)) || (!IsPlayerConnected(i))) continue;
if((pInfo[i][pAdminLevel] >= 1)) SendClientMessage(i, color, string);
}
return 1;
}

Boss201
04/12/2013, 11:56 AM
thanks its working