Need help, made a mistake making a command. -
up2u - 10.05.2011
Код:
if (strcmp(cmd, "/spban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spban(Special Person Ban) [playerid/PartOfName] [reason]");
return 1;
}
if (PlayerInfo[playerid][pAge] == 310518 )
{
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
BanLog(string);
new ip[128];
GetPlayerIp(giveplayerid,ip,128);
format(string, sizeof(string), "Banned Player's IP: %s", ip);
ABroadCast(COLOR_YELLOW,string,1);
strmid(PlayerInfo[giveplayerid][pBanReason], result, 0, strlen(result), 255);
PlayerInfo[giveplayerid][pBanned] = 1;
PlayerInfo[giveplayerid][pBans] += 1;
Ban(giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
Basically this is supposed to:
If you got The age of: 310518, And you type /spban [user id], Than it should ban that person.
So with this command you dont have to be admin to ban, But you need an sertain Age amouth.
But i dont understand what i did wrong.
Re: Need help, made a mistake making a command. -
o_O - 10.05.2011
What error? During compilation or run time?
Re: Need help, made a mistake making a command. -
up2u - 10.05.2011
compilation
Re: Need help, made a mistake making a command. -
Mean - 10.05.2011
What error in compilation?
Re: Need help, made a mistake making a command. -
o_O - 10.05.2011
pawn Код:
if (strcmp(cmd, "/spban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spban(Special Person Ban) [playerid/PartOfName] [reason]");
return 1;
}
if (PlayerInfo[playerid][pAge] == 310518 )
{
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
BanLog(string);
new ip[128];
GetPlayerIp(giveplayerid,ip,128);
format(string, sizeof(string), "Banned Player's IP: %s", ip);
ABroadCast(COLOR_YELLOW,string,1);
strmid(PlayerInfo[giveplayerid][pBanReason], result, 0, strlen(result), 255);
PlayerInfo[giveplayerid][pBanned] = 1;
PlayerInfo[giveplayerid][pBans] += 1;
Ban(giveplayerid);
return 1;
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
return 1;
}
Re: Need help, made a mistake making a command. -
up2u - 10.05.2011
Na its not the } i added that, Hold on
(PS: You see no mistakes as you look upon it? *low* im good)
Re: Need help, made a mistake making a command. -
o_O - 10.05.2011
It's your indentation that makes it too hard. Check my post now.
Re: Need help, made a mistake making a command. -
up2u - 10.05.2011
Код:
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41875) : error 010: invalid function or declaration
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41878) : error 010: invalid function or declaration
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41881) : error 010: invalid function or declaration
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41883) : error 010: invalid function or declaration
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41886) : error 021: symbol already defined: "getdate"
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41891) : error 021: symbol already defined: "BanLog"
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41893) : error 021: symbol already defined: "GetPlayerIp"
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41895) : error 021: symbol already defined: "ABroadCast"
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41900) : error 010: invalid function or declaration
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41903) : error 054: unmatched closing brace ("}")
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41904) : error 010: invalid function or declaration
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41910) : error 010: invalid function or declaration
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41912) : warning 203: symbol is never used: "day"
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41912) : warning 203: symbol is never used: "ip"
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41912) : warning 203: symbol is never used: "month"
C:\Documents and Settings\-Wesley-\Bureaublad\UnlimitedRP\gamemodes\U-RP.pwn(41912) : warning 203: symbol is never used: "year"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
12 Errors.
*Sigh*
This is making me angry
Re: Need help, made a mistake making a command. -
o_O - 10.05.2011
Cut the whole command and paste it somewhere else. See if it compiles that way.
Re: Need help, made a mistake making a command. -
o_O - 10.05.2011
pawn Код:
if (strcmp(cmd, "/spban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spban(Special Person Ban) [playerid/PartOfName] [reason]");
return 1;
}
if (PlayerInfo[playerid][pAge] == 310518 )
{
// removed code here
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
return 1;
}
Try that.