30.12.2014, 18:12
You can't do this with a switch-case statement.
You can however loop through your array and search for the pickupid.
Eventually you could use a switch-case after the loop, as soon as you find the index in your array.
You can however loop through your array and search for the pickupid.
Eventually you could use a switch-case after the loop, as soon as you find the index in your array.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new index;
for (index = 0; index < sizeof(variable); index++)
{
if (variable[index] == pickupid)
{
// You can do something here
// Then end the search through the array, as the pickup was found
// The For-loop will be exited, but "index" will still hold the value where the pickup was found
break;
}
}
// Here, "index" still holds the index of your array where the pickup was found, and can be used by a switch-case statement
switch(index)
{
case 0:
{
//
}
case 1:
{
//
}
case 2:
{
//
}
}
return 1;
}