case problem
#1

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;
}
Reply
#2

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;
}
Reply
#3

Код:
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;
}
Reply
#4

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

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

now it is, i just asked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)