Any other methodes to do this?
#8

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
so it would be something like this?

PHP код:
       new VehID GetPlayerVehicleID(playerid);
    if(
newstate == PLAYER_STATE_DRIVER && (VehIDgVIPVehicles[37])){
         if(
VIPInfo[playerid][VIPLevel] > 0){
            
SendClientMessage(playeridYELLOW"[VIP]: Welcome to VIP Vehicle");
            return 
1;
        }
        else{
            
ErrorMessages(playerid1);
            
RemovePlayerFromVehicle(playerid);
        }
    } 
because it didn't work, the client message didn't showup neither ways
No. By entering the literal 37, you specifically specify that the message should only show when being the driver of the 38th vehicle.

PHP код:
IsVIPVehicle(vehicleid) {
    for(new 
isizeof(gVIPVehicles); ji++) {
        if(
vehicleid == gVIPVehicles[i]) {
            return 
true;
        }
    }
    return 
false;

You loop through all the VIP vehicles and check whether the vehicleid returned by GetPlayerVehicleID is equal to any of them. If so: return true, else: return false.

PHP код:
if(newstate == PLAYER_STATE_DRIVER && IsVIPVehicle(VehID)) {
    
// Code for when the player is in a VIP vehicle

The return value of IsVIPVehicle is then used in the if statement. The && requires both newstate == PLAYER_STATE_DRIVER and IsVIPVehicle(VehID) to be true before executing the code in the if's body.
Reply


Messages In This Thread
Any other methodes to do this? - by Eoussama - 07.10.2016, 20:14
Re: Any other methodes to do this? - by EtayJ - 07.10.2016, 20:17
Re: Any other methodes to do this? - by AbyssMorgan - 07.10.2016, 20:35
Re: Any other methodes to do this? - by Vince - 07.10.2016, 20:56
Re: Any other methodes to do this? - by Eoussama - 07.10.2016, 21:12
Re: Any other methodes to do this? - by Vince - 07.10.2016, 21:16
Re: Any other methodes to do this? - by Eoussama - 07.10.2016, 21:45
Re: Any other methodes to do this? - by AndySedeyn - 07.10.2016, 22:05

Forum Jump:


Users browsing this thread: 1 Guest(s)