[HELP ME]Found this script somewhere...
#1

I found this bit of code:
pawn Код:
stock IsPlayerInRangeOfVehicle(playerid, vehicleid, Float:Range)
{
    new Float:Pos[3];
    GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
    return IsPlayerInRangeOfPoint(playerid, Range, Pos[0], Pos[1], Pos[2]);
}
So I decided to make a /destroyv command. Here it is:
pawn Код:
dcmd_destroyv(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Admin] >= 2)
    {
        if(IsPlayerInRangeOfVehicle(playerid,vehicleid,10))
        {
            DestroyVehicle(vehicleid);
            new name[24];
            new string[128];
            GetPlayerName(playerid,name,sizeof(name));
            format(string,sizeof(string),"Server: %s (id:%d) has deleted all vehicles around them",name,playerid);
            return SendClientMessage(playerid,orange,string);
        }
    }
    return 1;
}
But vehicleid is undefined... How to define it?
Reply
#2

pawn Код:
dcmd_destroyv(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Admin] >= 2)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(IsPlayerInRangeOfVehicle(playerid,vehicleid,10))
        {
            DestroyVehicle(vehicleid);
            new name[24];
            new string[128];
            GetPlayerName(playerid,name,sizeof(name));
            format(string,sizeof(string),"Server: %s (id:%d) has deleted all vehicles around them",name,playerid);
            return SendClientMessage(playerid,orange,string);
        }
    }
    return 1;
}
Reply
#3

Thanks! +Rep
Reply
#4

EDIT: Someone posted before hand.
Reply
#5

Oh, but this only works if I get in the vehicle. Is there anyway to do it without having to get into the vehicle?
Reply
#6

You want it so they respawn back to their original positions?
Reply
#7

pawn Код:
new vehicleid;
for(new i=1; i<MAX_VEHICLES;i++)
{
    if(IsPlayerInRangeOfVehicle(playerid,i)
        vehicleid=i,break;
}
if(!vehicleid) return SendClientMessage(playerid,RED," You are too far from a vehicle!");
Reply
#8

I want it so that they delete, and they respawn after a default time or something?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)