Case error and a warning -
davve95 - 28.03.2013
Hi!
I got some error when I tierd to make a turf war system with
"case" Well I don't know how to explain, but you will understand
when you see the code below.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == GolfTurf)
{
switch(gTeam [playerid])
{
case 0: SetTimer("GolfTurfT", 5000,false); //If the Clowns tries to take turf.
case 1: SendClientMessage(playerid, Clown, "Test lol");
return 1;
}
Код:
D:\Davids\Scripting\Server Las Venturas TDM\LVgZone.pwn(1165) : error 002: only a single statement (or expression) can follow each "case"
D:\Davids\Scripting\Server Las Venturas TDM\LVgZone.pwn(1165) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: Case error and a warning -
Vince - 28.03.2013
Fix the braces! Why is it so hard to do this right the first time? You have the return in the wrong spot.
Re: Case error and a warning -
Konstantinos - 28.03.2013
Quote:
Originally Posted by Vince
Fix the braces! Why is it so hard to do this right the first time? You have the return in the wrong spot.
|
What Vince means is that:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == GolfTurf)
{
switch(gTeam [playerid])
{
case 0: SetTimer("GolfTurfT", 5000,false); //If the Clowns tries to take turf.
case 1: SendClientMessage(playerid, Clown, "Test lol");
}
}
return 1;
}
Re: Case error and a warning -
davve95 - 28.03.2013
Quote:
Originally Posted by Vince
Fix the braces! Why is it so hard to do this right the first time? You have the return in the wrong spot.
|
Yeah, where should the return be?..
Sorry if I'm abit sluggish but I'm really tierd xD..
But anyway I tired to put it (return 1

under the last brace.. But then I got a hell alot of
errors so that coulden't be right..
I hope this isn't a easy problem that I don't see temporary lol.
Edit:
Dwane @ thanks alot!..
I didn't notice your post as I edited mine.
Re: Case error and a warning -
Omirrow - 28.03.2013
pawn Код:
if(pickupid == GolfTurf)
{
if(gTeam[playerid] == 0)
{
SetTimer("GolfTurfT", 5000,false); //If the Clowns tries to take turf.
}
if(gTeam[playerid] == 1)
{
SendClientMessage(playerid, Clown, "Test lol");
}
return 1;
}
Can you try this way?
Re: Case error and a warning -
davve95 - 28.03.2013
Quote:
Originally Posted by Omirrow
pawn Код:
if(pickupid == GolfTurf) { if(gTeam[playerid] == 0) { SetTimer("GolfTurfT", 5000,false); //If the Clowns tries to take turf. } if(gTeam[playerid] == 1) { SendClientMessage(playerid, Clown, "Test lol"); } return 1; }
Can you try this way?
|
Yeah I will try it..
It seems that the other script won't "fit"
as I have some shit above (to other pickups)
And I can't get return 1 to left much as possible then it will get me
loose indentation.
Or yeah, I can't use my brain, it won't work very well lol as I'm very tierd lol
so I will try it out tomorrow..
I hope you understand what I meant above ^^ ...
But thanks alot guys!.