Load/Unload vehicle
#1

I want to make this system,when player go off server his vehicle position will be saved and next time when he login his vehicle will be there where he /v park it,It annoying to see all those cars all over the city thats why I need this
Reply
#2

Bump
Reply
#3

pawn Код:
new Float:x[MAX_PLAYERS],Float:y[MAX_PLAYERS],Float:z[MAX_PLAYERS],a[MAX_PLAYERS];
new vid[MAX_PLAYERS];
new veh[MAX_PLAYERS];
CMD:v(playerid,params) //using ZCMD
{
    new sc[10]; //subcommand
    if(sscanf(params,"s[10]",sc)) return SendClientMessage(playerid,-1,"/v [subcommand]");
    if(strcmp(sc,"park",true)==0)
    {
        if(!IsPlayerInAnyVegicle(playerid)) return SendClientMessage(playerid,-1,"You must be in vehicle");
        new Float:pos[3],id,Float:ang;
        GetPlayerFacingAngle(playerid,ang);
        id = GetPlayerVehicleID(playerid);
        GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
        //Open users data file here
        //Insert value of vehicleid and pos in user data file
        //Close file
        return true;
    }  
}

public OnPlayerConnect(playerid)
{
    //Before reading player file
    x[playerid]=y[playerid]=z[playerid]=vid[playerid]=a[playerid] -1;
    //Now read player file and insert values of x,y,z,vid from file to variables
   

    //After reading check for values not equal to -1
    if(vid[playerid] != -1)
    {
        veh[playerid] = CreateVehicle(vid[playerid],x[playerid],y[playerid],z[playerid],a[playerid],-1,-1,60);
    }
}

public OnPlayerDisconnect(...)
{
    DestroyVehicle(veh[playerid]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)