Make a respawn car nearest command..
#1

Okey, how can I make a respawn car command that will respawn my nearest car?
I tryed this but I failed.
Here is the code:
pawn Код:
dcmd_respawncar(playerid, params[])
{
    #pragma unused params
    if(adminlevel[playerid] >= 2)
    {
        for(new car=0; car<MAX_VEHICLES; car++)
        {
            new Float: X, Float: Y, Float: Z;
            GetPlayerPos(playerid, X, Y, Z);
            if(IsPlayerInRangeOfPoint(car, 3.5, X, Y, Z))
            {
                SetVehicleToRespawn(car);
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "No car in here!");
            }
            new str[35];
            format(str, 35, "Car ID: %i was respawned.", car);
            SendClientMessage(playerid, COLOR_GREY, str);
        }
    }
    else SendClientMessage(playerid, COLOR_GREY, "You are not admin!");
    return 1;
}
Thanks
Reply
#2

Use GetVehiclePos instead GetPlayerPos, it should be

pawn Код:
GetVehiclePos(car, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 3.5, X, Y, Z))
{
//
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)