Script help... -
chriswilson - 10.03.2010
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.
Re: Script help... -
Torran - 10.03.2010
Show your code?
Well the bit around where your getting errors
Re: Script help... -
chriswilson - 10.03.2010
Код:
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
Re: Script help... -
Torran - 10.03.2010
Tell me which lines are 102 and 104
Re: Script help... -
chriswilson - 10.03.2010
102 ---> the return 0;
104 is not even on the script >.<
Re: Script help... -
Mike Garber - 10.03.2010
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
Re: Script help... -
gotenks918 - 10.03.2010
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;
}
Re: Script help... -
chriswilson - 10.03.2010
opps thanks that fixed it xD
thanks I gotta watch for that more
Re: Script help... -
Deat_Itself - 10.03.2010
Код:
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.
Re: Script help... -
aircombat - 10.03.2010
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;
}