Error help - 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)
+--- Thread: Error help (
/showthread.php?tid=577230)
Error help -
sscarface - 10.06.2015
I'm using this. and trying to make car shop.
Like this:
if player enter in checkpoint he gets main menu for example like:
1. Cars
2. Bikes
if he select cars by type '1' then another textdraw will be opened like
1. infernus
2. bullet
if he selects by type '2' bike then another textdraw will be opened like
1. FCR
2.PCJ
here's my code.
PHP код:
public OnPlayerText(playerid, text[])
{
if(carshopdentry{playerid}) // check if player in checkpoint or what
{
switch(carshopdentry{playerid})
{
case CARSHOPBOX: // main menu like 1. cars 2. bikes
{
switch(strval(text))
{
case 1: /// here if he selects 1 then it should show this to player
{
//Show your guns textdraw here.
TextDrawShowForPlayer(playerid, CARSHOPBOX);
TextDrawShowForPlayer(playerid, vehicleshop);
}
case 2: here if he selects 2 then it should show this to player
{
//Show your food textdraw here.
TextDrawShowForPlayer(playerid, CARSHOPBOX);
TextDrawShowForPlayer(playerid, bikeshop);
}
}
}
case vehicleshop://If they selected the car i mean '1' = cars textdraw,
{
switch(strval(text))//Switch through the number they type in.
{
case 1: GivePlayerWeapon(playerid,22,50); // dnt mind this weapon i just checking it i will change it later and give vehicle to player
}
}
case bikeshop:
{
switch(strval(text))//Switch through the number they type in.
{
case 1: GivePlayerWeapon(playerid,31,50);//Give the player the weapon they typed the option for
}
}
}
return 0;
}
Re: Error help -
DarkLored - 10.06.2015
try this the problem was that you used "{playerid}" instead of this "[playerid]"
pawn Код:
public OnPlayerText(playerid, text[])
{
if(carshopdentry[playerid]) // check if player in checkpoint or what
{
switch(carshopdentry[playerid])
{
case CARSHOPBOX: // main menu like 1. cars 2. bikes
{
switch(strval(text))
{
case 1: /// here if he selects 1 then it should show this to player
{
//Show your guns textdraw here.
TextDrawShowForPlayer(playerid, CARSHOPBOX);
TextDrawShowForPlayer(playerid, vehicleshop);
}
case 2: here if he selects 2 then it should show this to player
{
//Show your food textdraw here.
TextDrawShowForPlayer(playerid, CARSHOPBOX);
TextDrawShowForPlayer(playerid, bikeshop);
}
}
}
case vehicleshop://If they selected the car i mean '1' = cars textdraw,
{
switch(strval(text))//Switch through the number they type in.
{
case 1: GivePlayerWeapon(playerid,22,50); // dnt mind this weapon i just checking it i will change it later and give vehicle to player
}
}
case bikeshop:
{
switch(strval(text))//Switch through the number they type in.
{
case 1: GivePlayerWeapon(playerid,31,50);//Give the player the weapon they typed the option for
}
}
}
return 0;
}
Re: Error help -
sscarface - 10.06.2015
I did this what you said but got same 3 errors
PHP код:
(2336) : error 008: must be a constant expression; assumed zero
(2354) : error 008: must be a constant expression; assumed zero
(2361) : error 008: must be a constant expression; assumed zero
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Errors.
PHP код:
LINE 2336: case CARSHOPBOX:
Line 2354: case vehicleshop
line 2361: case bikeshop:
Re: Error help -
Dangjai - 10.06.2015
Try and tell me.
Re: Error help -
sscarface - 10.06.2015
Nah, didn't work. Got many errors
Re: Error help -
Dangjai - 10.06.2015
PHP код:
case CARSHOPBOX);
Try this one I hope it works.
Re: Error help -
J0sh... - 10.06.2015
@Kinglee Please learn what case is. Adding ; or ); will not help.
Re: Error help -
sscarface - 10.06.2015
Anyone help?
Re: Error help -
DarkLored - 10.06.2015
pawn Код:
public OnPlayerText(playerid, text[])
{
if(carshopdentry{playerid}) // check if player in checkpoint or what
{
switch(carshopdentry{playerid})
{
case CARSHOPBOX: // main menu like 1. cars 2. bikes
{
switch(strval(text))
{
case 0: /// here if he selects 1 then it should show this to player
{
//Show your guns textdraw here.
TextDrawShowForPlayer(playerid, CARSHOPBOX);
TextDrawShowForPlayer(playerid, vehicleshop);
}
case 1: here if he selects 2 then it should show this to player
{
//Show your food textdraw here.
TextDrawShowForPlayer(playerid, CARSHOPBOX);
TextDrawShowForPlayer(playerid, bikeshop);
}
}
}
case vehicleshop://If they selected the car i mean '1' = cars textdraw,
{
switch(strval(text))//Switch through the number they type in.
{
case 0: GivePlayerWeapon(playerid,22,50); // dnt mind this weapon i just checking it i will change it later and give vehicle to player
}
}
case bikeshop:
{
switch(strval(text))//Switch through the number they type in.
{
case 0: GivePlayerWeapon(playerid,31,50);//Give the player the weapon they typed the option for
}
}
}
return 0;
}
the problem was that you used case 1 as the first case but the 1 case is actually 0.
Re: Error help -
AlexBlack - 10.06.2015
don't forget to change the {playerid} to the [playerid] .