SA-MP Forums Archive
[HELP] Whats wrong? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Whats wrong? (/showthread.php?tid=138312)



[HELP] Whats wrong? - Thrarod - 01.04.2010

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



Re: [HELP] Whats wrong? - Thrarod - 01.04.2010

Noany help?


Re: [HELP] Whats wrong? - [MWR]Blood - 01.04.2010

Show me line 382


Re: [HELP] Whats wrong? - Thrarod - 01.04.2010

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)


Re: [HELP] Whats wrong? - Last_Stand_Guardian - 01.04.2010

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


Re: [HELP] Whats wrong? - Thrarod - 01.04.2010

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


Re: [HELP] Whats wrong? - Last_Stand_Guardian - 01.04.2010

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 ^^