Trunk system
#4

You could try this out.

pawn Код:
//When creating a car use.... V
//VehID[playerid] = CreateVehicle(vehid, X, Y, Z, 0.0, random(130), random(130), 0);

new VehID[MAX_PLAYERS]; //Let's store the vehicle ID of the player

public OnPlayerDisconnect(playerid)
{
    VehID[playerid] = -1;
    return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(strfind(cmdtext, "trunk", true) != -1)
    {
        new vehid2 = VehID[playerid];
        if(IsPlayerNearVehicle(playerid, vehid2, 5.0) && vehid2 != -1) //The player is near his vehicle
        {
            SendClientMessage(playerid, 0xFFFFFF, "User used command /trunk and is near his car!");
            return 1;
        }
    }
    return 1;
}

IsPlayerNearVehicle(playerid, vehicleid, float:range) //Is player near the vehicle *range
{
    new Float:X, Y, Z;
    GetVehiclePos(vehicleid, X, Y, Z);
    if(IsPlayerInRangeOfPoint(playerid, X, Y, Z, range) return 1;
    return 0;
}
Reply


Messages In This Thread
Trunk system - by Xenforox - 08.07.2014, 00:24
Re: Trunk system - by Threshold - 08.07.2014, 00:34
Re : Re: Trunk system - by Xenforox - 08.07.2014, 00:36
Re: Trunk system - by ABKPot - 08.07.2014, 00:49

Forum Jump:


Users browsing this thread: 5 Guest(s)