if(IsPlayerInDynamicCP(playerid, STW))
{
if(IsWorking[playerid] != 0)
{
SendClientMessage(playerid, COLOR_RED, "You already have a job! finish it or type /kill");
return 1;
}
if(vehicle != 516)
{
SendClientMessage(playerid, COLOR_RED, "You are not in the right vehicle for this mission!");
return 1;
}
if(gTeam[playerid] == TEAM_DRIVERS)
{
IsWorking[playerid] = 1;
TogglePlayerDynamicCP(playerid, STW, false); // This makes sure that there will be a new checkpoint
//hier zullen dan de random moeten komen
new mrand = random(2);
if(mrand == 1)
{
TogglePlayerDynamicCP(playerid, TRAVJ1, true); // Creates a new checkpoint at a different position
SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 41, 0, MAPICON_GLOBAL );
GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3);
SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|");
//De Textdraw
TextDrawShowForPlayer(playerid,Opdracht);
}
else if(mrand == 2)
{
SendClientMessage(playerid, COLOR_YELLOW, "|- This is just a test -|");
}
return 1;
}
}
hi, i wanna make a random trucking/taxi mission when a player enters a CP
to do that I made this code: pawn Код:
but when I pickup the pickup nothing happens, I don't get the messages from the first random option, and nor do I get any message from the second random thing :/ please help me thanks in advance |
A random number ranging from 0 to max-1. |
if(IsPlayerInDynamicCP(playerid, STW))
{
if(IsWorking[playerid] != 0)
{
SendClientMessage(playerid, COLOR_RED, "You already have a job! finish it or type /kill");
return 1;
}
if(vehicle != 516)
{
SendClientMessage(playerid, COLOR_RED, "You are not in the right vehicle for this mission!");
return 1;
}
if(gTeam[playerid] == TEAM_DRIVERS)
{
IsWorking[playerid] = 1;
TogglePlayerDynamicCP(playerid, STW, false); // This makes sure that there will be a new checkpoint
//hier zullen dan de random moeten komen
new mrand = random(3);
if(mrand == 1)
{
TogglePlayerDynamicCP(playerid, TRAVJ1, true); // Creates a new checkpoint at a different position
SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 41, 0, MAPICON_GLOBAL );
GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3);
SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|");
//De Textdraw
TextDrawShowForPlayer(playerid,Opdracht);
}
else if(mrand == 2)
{
SendClientMessage(playerid, COLOR_YELLOW, "|- This is just a test -|");
}
return 1;
}
}
switch(random(2))
{
case 0:
{
TogglePlayerDynamicCP(playerid, TRAVJ1, true); // Creates a new checkpoint at a different position
SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 41, 0, MAPICON_GLOBAL );
GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3);
SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|");
//De Textdraw
TextDrawShowForPlayer(playerid,Opdracht);
}
case 1: SendClientMessage(playerid, COLOR_YELLOW, "|- This is just a test -|");
}
It will be less buggy and faster using switch? Or just rasier to use?
|