Vehicle Check
#1

I want a help with codes that check whether the player is in vehicle or not when entering a checkpoint !

PHP код:
public OnPlayerEnterCheckpoint(playerid) {
    new 
string[128];
    new 
string1[128];
    switch(
MissionStage[playerid])  {
        case 
STAGE_IDLE: {} // do not remove
        
case STAGE_UNLOAD: {
            new 
RandomPay random(10000) + 5000name[MAX_PLAYER_NAME 1];
            
GetPlayerName(playeridnameMAX_PLAYER_NAME);
            
FreezePlayer(playerid3000);
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
            
GivePlayerMoneyplayeridRandomPay );
            
GameTextForPlayer(playerid"~g~Passengers UnLoading !"20004);
            
format(stringsizeof(string), " You Have Recieved $%i for Completing your Flight!"RandomPay);
            
SendClientMessage(playerid, -1string);
            
            
GetPlayerName(playeridstring1MAX_PLAYER_NAME);
            
format(stringsizeof(string1),"%s Completed a Flight!"RandomPay);
            
SendClientMessageToAll(COLOR_ORANGEstring);
            
SendClientMessage(playeridCOLOR_GREY"All Passengers had Been UnBoarded!");
            
MissionStage[playerid] = STAGE_IDLE;
        }
        default: { 
// STAGE_LOAD
            
new rand random(sizeof gAirports 1);
            if(
rand == (MissionStage[playerid] - STAGE_LOAD)) rand++;
            
FreezePlayer(playerid3000);
            
DisablePlayerCheckpoint(playerid);
            
GameTextForPlayer(playerid"~g~Passengers Boarding !"20004);
            
SetPlayerCheckpoint(playeridgAirports[rand][0], gAirports[rand][1], gAirports[rand][2], 10.0);
            
SendClientMessage(playeridCOLOR_GREY"All Passengers has Been Boarded and Fastened Their Seat Belts!");
            
MissionStage[playerid] = STAGE_UNLOAD;
        }
    }
    return 
false;

Reply
#2

Huh?

https://sampwiki.blast.hk/wiki/GetPlayerState
https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Player is driving a vehicle
if(IsPlayerInAnyVehicle(playerid)) // Player is inside a vehicle (driver or passenger)
Reply
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Huh?

https://sampwiki.blast.hk/wiki/GetPlayerState
https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Player is driving a vehicle
if(IsPlayerInAnyVehicle(playerid)) // Player is inside a vehicle (driver or passenger)
i already had this one

PHP код:
new vehiclemod GetVehicleModel(GetPlayerVehicleID(playerid));
       if(
vehiclemod == 500|| vehiclemod == (509) || vehiclemod == (594) ) 
i wanted to implement it in OnplayerEntercheckpoint
Reply
#4

@Shaheen, there's a difference between your code and the code of SickAttack.. Add his code, and you should do fine.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)