Script help...
#1

Hi I'm geting an error message I don't know how to fix , I'm a newbie so help please
Код:
C:\Documents and Settings\rentacenter\Desktop\Gta Folder\My Server[Testing, ect.]\filterscripts\GunScript.pwn(102) : warning 225: unreachable code
C:\Documents and Settings\rentacenter\Desktop\Gta Folder\My Server[Testing, ect.]\filterscripts\GunScript.pwn(104) : error 030: compound statement not closed at the end of file (started at line 82)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Show your code?
Well the bit around where your getting errors
Reply
#3

Код:
	if (strcmp("/buygun", cmdtext, true) == 0) {
		SendClientMessage(playerid, COLOR_BLUE, "Useage: /buygun <gunid> Check gun ids in /shop");
	
	return 1;
	}
	if (strcmp("/buygun 1", cmdtext, true) == 0) {
      GivePlayerMoney(playerid, -500);
      GivePlayerWeapon(playerid, 22, 500);
		return 1;

return 0;
}
its saying somethings wrong with the returns
Reply
#4

Tell me which lines are 102 and 104
Reply
#5

102 ---> the return 0;
104 is not even on the script >.<
Reply
#6

When you put an open bracket ( { ) you have to close It at the end of the code ( } ).

You cannot return two or more times in a row, I guess this will work;

pawn Код:
if (strcmp("/buygun", cmdtext, true) == 0) {
        SendClientMessage(playerid, COLOR_BLUE, "Useage: /buygun <gunid> Check gun ids in /shop");
   
    return 1;
    }
    if (strcmp("/buygun 1", cmdtext, true) == 0) {
      GivePlayerMoney(playerid, -500);
      GivePlayerWeapon(playerid, 22, 500);
    return 1;
     } // THIS IS WHAT YOU FORGOT

return 0; // Make sure this is at the end of OnPlayerCommandText otherwise return 0; is not correct here.
}
I'm not at my computer and cannot try It.
Sorry, but this forum sucks at code intendention xD
Reply
#7

You are returning both 1 and 0 in the same if statement.
pawn Код:
if (strcmp("/buygun", cmdtext, true) == 0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "Useage: /buygun <gunid> Check gun ids in /shop");
        return 1;
    }
    if (strcmp("/buygun 1", cmdtext, true) == 0)
    {
      GivePlayerMoney(playerid, -500);
      GivePlayerWeapon(playerid, 22, 500);
      return 1;
    }
Reply
#8

opps thanks that fixed it xD
thanks I gotta watch for that more
Reply
#9

Код:
	if (strcmp("/buygun", cmdtext, true) == 0) {
SendClientMessage(playerid, COLOR_BLUE, "Useage: /buygun <gunid> Check gun ids in /shop");

if (strcmp("/buygun 1", cmdtext, true) == 0) {
      GivePlayerMoney(playerid, -500);
      GivePlayerWeapon(playerid, 22, 500);
return 1;
     }

return 0;
}
try this one it works fine.
Reply
#10

if (strcmp("/buygun", cmdtext, true) == 0) {
SendClientMessage(playerid, COLOR_BLUE, "Useage: /buygun <gunid> Check gun ids in /shop");

return 1;
}
if (strcmp("/buygun 1", cmdtext, true) == 0) {
GivePlayerMoney(playerid, -500);
GivePlayerWeapon(playerid, 22, 500);
return 1;
}

return 0;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)