SA-MP Forums Archive
case problem - 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: case problem (/showthread.php?tid=152554)



case problem - Nonameman - 04.06.2010

Hey,

I'm using [REL] Streamer Plugin v2.3.8, and I created a dynamic checkpoint, which i want to make work.

Here is the code:

Код:
new LottoCP;

public OnGameModeInit()
{
LottoCP = CreateDynamicCP(2424.1038,-1742.7649,13.5443, 1, -1, 0, -1, 10);
return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
switch(checkpointid)
{
case LottoCP: //the problem is with this line, the compiler's error message say: error 008: must be a constant expression; //assumed zero 
{
SendClientMessage(playerid, color, "Welcome! Here you can buy lotto ticket with the /lotto command.");
}
}
return 1;
}



Re: case problem - ViruZZzZ_ChiLLL - 04.06.2010

pawn Код:
new LottoCP;

public OnGameModeInit()
{
LottoCP = CreateDynamicCP(2424.1038,-1742.7649,13.5443, 1, -1, 0, -1, 10);
return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == LottoCP)
{
SendClientMessage(playerid, color, "Welcome! Here you can buy lotto ticket with the /lotto command.");
}
return 1;
}



Re: case problem - Kar - 04.06.2010

Код:
new LottoCP;

public OnGameModeInit()
{
LottoCP = CreateDynamicCP(2424.1038,-1742.7649,13.5443, 1, -1, 0, -1, 10);
return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == LottoCP)
{
SendClientMessage(playerid, color, "Welcome! Here you can buy lotto ticket with the /lotto command.");
}
return 1;
}



Re: case problem - Nonameman - 04.06.2010

thx, I was thinking about to rewrite it as you, so can't I use case function here?


Re: case problem - Sergei - 04.06.2010

You can use switch only for constant values. Isn't it obvious?


Re: case problem - Nonameman - 04.06.2010

now it is, i just asked