[HELP] Whats wrong?
#1

I wrote a /rob command but it doesnt work and I get errors!
Код:
	dcmd_rob(playerid,params[]) {
	if(PlayerVerify == 0) return SendClientMessage(playerid,COLOR_ERROR,"[Error] You must login/register before using commands /login [password] or /register [password]]");
	new tmp[256],Index; tmp = strtok(params,Index);
	if (GetPlayerWantedLevel(playerid) <= 0)) {
	SendClientMessage(playerid, COLOR_RED, " [Robbery] You just robbed a bank and you are wanted now"); }
	GivePlayerMoney(playerid, 500 + random(200));
	else if (GetPlayerWantedLevel(playerid) >= 1)) {
	SendClientMessage(playerid, COLOR_RED, " [Robbery] You can't rob a bank, you are wanted"); }
	return 1;
	}
Errors are
Код:
C:\Counter-Strike 2D\BlueberryFR\gamemodes\SFFreeroam3.0.pwn(379) : error 029: invalid expression, assumed zero
C:\Srv\gamemodes\SFFreeroam3.0.pwn(382) : error 029: invalid expression, assumed zero
C:\Srv\gamemodes\SFFreeroam3.0.pwn(382) : warning 215: expression has no effect
C:\Srv\gamemodes\SFFreeroam3.0.pwn(382) : error 001: expected token: ";", but found "if"
C:\Srv\gamemodes\SFFreeroam3.0.pwn(382) : error 029: invalid expression, assumed zero
C:\Srv\gamemodes\SFFreeroam3.0.pwn(382) : fatal error 107: too many error messages on one line
Reply
#2

Noany help?
Reply
#3

Show me line 382
Reply
#4

GivePlayerMoney(playerid, 500 + random(200));

Also I changed the code by mistake and shows less errors?
Код:
	dcmd_rob(playerid,params[]) {
	if(PlayerVerify == 0) return SendClientMessage(playerid,COLOR_ERROR,"[Error] You must login/register before using commands /login [password] or /register [password]]");
	new tmp[256],Index; tmp = strtok(params,Index);
	if (GetPlayerWantedLevel(playerid) <= 0)
	SendClientMessage(playerid, COLOR_RED, " [Robbery] You just robbed a bank and you are wanted now");
	GivePlayerMoney(playerid, 500 + random(200));
	else if (GetPlayerWantedLevel(playerid) >= 1)
	SendClientMessage(playerid, COLOR_RED, " [Robbery] You can't rob a bank, you are wanted");
	return 1;
	}
Errors
Код:
C:\Counter-Strike 2D\BlueberryFR\gamemodes\SFFreeroam3.0.pwn(382) : error 029: invalid expression, assumed zero
C:\Counter-Strike 2D\BlueberryFR\gamemodes\SFFreeroam3.0.pwn(382) : warning 215: expression has no effect
C:\Counter-Strike 2D\BlueberryFR\gamemodes\SFFreeroam3.0.pwn(382) : error 001: expected token: ";", but found "if"
New line 382 is

else if (GetPlayerWantedLevel(playerid) >= 1)
Reply
#5

Quote:
Originally Posted by Thrarod
pawn Код:
dcmd_rob(playerid,params[])
{
     if(PlayerVerify == 0) return SendClientMessage(playerid,COLOR_ERROR,"[Error] You must login/register before using commands /login [password] or /register [password]]");

     new tmp[256],Index; //why are you using this? o.o
     tmp = strtok(params,Index); // and this? O.o --> both never used here :O
     if(GetPlayerWantedLevel(playerid) <= 0)
     {
         SendClientMessage(playerid, COLOR_RED, " [Robbery] You just robbed a bank and you are wanted now");
         GivePlayerMoney(playerid, 500 + random(200));
     }
     else if (GetPlayerWantedLevel(playerid) >= 1)
     {
         SendClientMessage(playerid, COLOR_RED, " [Robbery] You can't rob a bank, you are wanted");
         return 1;
         //Or: return SendClientMessage(playerid, COLOR_RED, " [Robbery] You can't rob a bank, you are wanted");
     }
}
I don't know if it works, but it looks more clear :O
Reply
#6

Worked and worked, the things you wrote useless makes dcmd dont give errors for params
Reply
#7

Quote:
Originally Posted by Thrarod
Worked and worked, the things you wrote useless makes dcmd dont give errors for params
Thank you , you live and learn xD ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)