Help with the trailer
#6

Quote:
Originally Posted by Mencent
View Post
I think an option is to use a timer. There are many other solutions, but try this:
PHP Code:
//global variable:
new TruckTimer[MAX_PLAYERS];
//when you enter the truck:
TruckTimer[playerid] = SetTimerEx("OnPlayerAttachTrailer",1000,1,"i",playerid);
//when you left the truck:
KillTimer(TruckTimer[playerid]);
TruckTimer[playerid] = 0;
forward OnPlayerAttachTrailer(playerid);
public 
OnPlayerAttachTrailer(playerid)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if(!
IsTrailerAttachedToVehicle(vehicleid))return 1;
    if(
pInfo[playerid][pLevel] > 2)
    {
        if(
GetPVarInt(playerid,"TRUCK_MERCH") == 1)
        {
            new 
Tipe[20],trailerid GetVehicleTrailer(vehicleid);
            switch(
GetVehicleModel(trailerid))
            {
                case 
435Tipe "Cereal";
            }
            
SetPlayerCheckpoint(playerid, -2457.8601,2291.7852,5.09907);
            
SetPVarInt(playerid"TRUCK_MERCH"2);
            
DeletePVar(playerid"TRUCK_GO");
               
c_clvl2_e1_b false;
            
SendClientMessage(playerid, -1"Go to the checkpoint");
            
RemovePlayerMapIcon(playeridCEREAL_DEPOSIT);
            
SetPVarInt(playerid"TRUCK_GOING"2);
            return 
1;
        }
    }
    return 
1;

Code:
warning 219: local variable "vehicleid" shadows a variable at a preceding level
warning 219: local variable "trailerid" shadows a variable at a preceding level
Reply


Messages In This Thread
Help with the trailer - by zZzTGTzZz - 16.11.2018, 18:15
Re: Help with the trailer - by Mencent - 16.11.2018, 20:46
Re: Help with the trailer - by KinderClans - 16.11.2018, 20:48
Re: Help with the trailer - by zZzTGTzZz - 16.11.2018, 21:08
Re: Help with the trailer - by Mencent - 17.11.2018, 05:45
Re: Help with the trailer - by zZzTGTzZz - 17.11.2018, 13:21

Forum Jump:


Users browsing this thread: 1 Guest(s)