PDA

View Full Version : need help at /Ask CMD


wumpyc
28/12/2011, 11:05 AM
hey this is a simple cmd for asking an admin for help...and that admin answer you...but i've got a lot of errors
my code:


CMD:a(playerid,params[])
{
new text[200],pname[32],string[128];
if(sscanf(params,"s",text)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /a {question or bug report to admins}");
for(new i=0,i<MAX_PLAYERS;i++)
{
if(!APlayerData[i][PlayerLevel] >= 1) return SendClientMessage(playerid,0xFF0000FF,"No admins currently online");
}
GetPlayerName(playerid,pname,32);
format(string,128,"{00B2FF}%s needs help :{00FF00} %s",pname,text);
for(i=0,i<MAX_PLAYERS;i++)
{
if(APlayerData[i][PlayerLevel] >= 1) return SendClientMessage(i,0xFF0000FF,string);
}
format(string,128,"{00B2FF}Message sent to admins: {00FF00}%s",text);
SendClientMessage(playerid,0xFFFFFFFF,string);
}
return 1;
}
CMD:b(playerid,params[])
{
SendAdminText(playerid, "/b", params);
new text[200],pname[32],string[128],op;
if(APlayerData[playerid][PlayerLevel] = 0) return SendClientMessage(playerid,0xff0000ff,"You aren't an admin");
if(sscanf(params,"us",op,text)) return SendClientMessage(playerid,0xFF0000,"USAGE:/b {player} {answer}");
GetPlayerName(playerid,pname,32);
format(string,sizeof(string),"{00B2FF}Answer of Admin %s : {00FF00}%s",pname,text);
SendClientMessage(op,0xffffffff,string);
GetPlayerName(op,pname,32);
format(string,128,"{00B2FF}Answer send to %s : {00FF00}%s",pname,text);
SendClientMessage(playerid,0xffffffff,string);
return 1;
}


Errors:


C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1470) : error 021: symbol already defined: "i"
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1470) : warning 206: redundant test: constant expression is non-zero
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1472) : warning 213: tag mismatch
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1470) : warning 204: symbol is assigned a value that is never used: "i"
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1470 -- 1474) : warning 225: unreachable code
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1476) : error 021: symbol already defined: "i"
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1476) : warning 206: redundant test: constant expression is non-zero
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1476) : warning 204: symbol is assigned a value that is never used: "i"
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1476 -- 1480) : warning 225: unreachable code
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1482) : warning 209: function "cmd_a" should return a value
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1483) : error 010: invalid function or declaration
C:\Documents and Settings\wumpyc\Desktop\PPC_Trucking\gamemodes\PPC _Trucking.pwn(1489) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.



Help fast please :D

thimo
28/12/2011, 11:08 AM
Try this:

CMD:a(playerid,params[])
{
new text[200],pname[32],string[128];
if(sscanf(params,"s",text)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /a {question or bug report to admins}");
for(new i=0,i<MAX_PLAYERS;i++)
{
if(!APlayerData[i][PlayerLevel] >= 1) return SendClientMessage(playerid,0xFF0000FF,"No admins currently online");
GetPlayerName(playerid,pname,32);
format(string,128,"{00B2FF}%s needs help :{00FF00} %s",pname,text);
if(APlayerData[i][PlayerLevel] >= 1) return SendClientMessage(i,0xFF0000FF,string);

format(string,128,"{00B2FF}Message sent to admins: {00FF00}%s",text);
SendClientMessage(playerid,0xFFFFFFFF,string);
}
return 1;
}
CMD:b(playerid,params[])
{
SendAdminText(playerid, "/b", params);
new text[200],pname[32],string[128],op;
if(APlayerData[playerid][PlayerLevel] = 0) return SendClientMessage(playerid,0xff0000ff,"You aren't an admin");
if(sscanf(params,"us",op,text)) return SendClientMessage(playerid,0xFF0000,"USAGE:/b {player} {answer}");
GetPlayerName(playerid,pname,32);
format(string,sizeof(string),"{00B2FF}Answer of Admin %s : {00FF00}%s",pname,text);
SendClientMessage(op,0xffffffff,string);
GetPlayerName(op,pname,32);
format(string,128,"{00B2FF}Answer send to %s : {00FF00}%s",pname,text);
SendClientMessage(playerid,0xffffffff,string);
return 1;
}

wumpyc
28/12/2011, 11:14 AM
tnx thimo, rep + for you :D

thimo
28/12/2011, 11:15 AM
Np, Thanks :)