SA-MP Forums Archive
Make a respawn car nearest command.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Make a respawn car nearest command.. (/showthread.php?tid=177148)



Make a respawn car nearest command.. - Fedee! - 16.09.2010

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


Re: Make a respawn car nearest command.. - CuervO - 16.09.2010

Use GetVehiclePos instead GetPlayerPos, it should be

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