How to Check if a Player Owns a Certain Vehicle
#4

add vehicle model collumn to your database
pawn Код:
YCMD:v_park(playerid, params[], help)
{
    new query[500];
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(PR[playerid][VehiclesOwned] == 0) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You don't even have a vehicle yet!");
        new vehicleid = GetPlayerVehicleID(playerid);
        if(!strcmp(PR[vehicleid][Name],PR[playerid][Name])&&(PR[vehicleid][UserID]==playerid)) //<<<<<<<<<<<
        {
            new Float:x, Float:y, Float:z, Float:angle,vehmodel;
            GetVehicleZAngle(vehicleid, angle);
            GetVehiclePos(vehicleid, x, y, z);
            x = PR[playerid][parkX];
            y = PR[playerid][parkY];
            z = PR[playerid][parkZ];
            angle = PR[playerid][Angle];
            mysql_format(dbHandle, query, sizeof(query), "UPDATE `playerrelated` SET `parkX` = %f, `parkY` = %f, `parkZ` = %f, `Angle` = %f WHERE `Name` = '%s'", x, y, z, angle, GetName(playerid)); // add collumn to your SQL for vehicle model
            mysql_tquery(dbHandle, query);
            DestroyVehicle(vehicleid);
            //also destroy the PR[vehicleid][UserID] and PR[vehicleid][Name]
        }
        else
        {
            return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] This isn't your vehicle! Therefore you can not park it!");
        }
       
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You are not in any vehicle!");
    return 1;
}
Reply


Messages In This Thread
How to Check if a Player Owns a Certain Vehicle - by Ox1gEN - 15.12.2014, 20:32
Re: How to Check if a Player Owns a Certain Vehicle - by ikey07 - 15.12.2014, 20:47
Re: How to Check if a Player Owns a Certain Vehicle - by Mic_H - 16.12.2014, 01:49
Re: How to Check if a Player Owns a Certain Vehicle - by Quickie - 16.12.2014, 02:37
Re: How to Check if a Player Owns a Certain Vehicle - by Mic_H - 16.12.2014, 02:49
Re: How to Check if a Player Owns a Certain Vehicle - by Ox1gEN - 16.12.2014, 08:12

Forum Jump:


Users browsing this thread: 1 Guest(s)