no cars in here!
#1

How can I do some thing to prevent players from spawning cars in this coordinates: 1958.3783, 1343.1572, 15.3746 and if they do the car destroys. Help please.
Reply
#2

I think you can use IsPlayerInRangeOfPoint for that.
Reply
#3

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
I think you can use IsPlayerInRangeOfPoint for that.
Yeah but how I do it
Reply
#4

pawn Код:
CMD:car(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)) return 0; //means the command stops here (gives UNKNOWN COMMAND)
}
The range would be how close to those coords do you want to check. So, everyone inside of the range you specify won't be able to spawn a car.
Reply
#5

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
pawn Код:
CMD:car(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)) return 0; //means the command stops here (gives UNKNOWN COMMAND)
}
The range would be how close to those coords do you want to check. So, everyone inside of the range you specify won't be able to spawn a car.
Where in my script do I place this code? and i'm using regular /command. like for esxample: /teleports
Reply
#6

Just under your car command. Something like this

pawn Код:
/CAR COMMAND IN WHAT EVER COMMAND PROCESSOR
{
    if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)) return 0; //means the command stops here (gives UNKNOWN COMMAND)
   
    THE REST OF YOUR COMMAND STUFF
}
Reply
#7

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
Just under your car command. Something like this

pawn Код:
/CAR COMMAND IN WHAT EVER COMMAND PROCESSOR
{
    if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)) return 0; //means the command stops here (gives UNKNOWN COMMAND)
   
    THE REST OF YOUR COMMAND STUFF
}
did't work... ok now lets say I rcon admin and get in a car. how do I create the command /destroycar to destroy the car where I'm at (forget about all the coord and all that act like I haven never said that before )
Reply
#8

Quote:
Originally Posted by Lauder
Посмотреть сообщение
did't work... ok now lets say I rcon admin and get in a car. how do I create the command /destroycar to destroy the car where I'm at (forget about all the coord and all that act like I haven never said that before )
pawn Код:
if(strcmp(cmdtext, "/destroycar", true) == 0)
{
    if(!IsPlayerAdmin(playerid)) return 1;
    new Float:X, Float:Y, Float:Z;
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        GetVehiclePos(i, X, Y, Z);
        if(IsPlayerInRangeOfPoint(playerid, 10.0, X, Y, Z))
        {
            DestroyVehicle(i);
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by CodyCummings
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext, "/destroycar", true) == 0)
{
    if(!IsPlayerAdmin(playerid)) return 1;
    new Float:X, Float:Y, Float:Z;
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        GetVehiclePos(i, X, Y, Z);
        if(IsPlayerInRangeOfPoint(playerid, 10.0, X, Y, Z))
        {
            DestroyVehicle(i);
        }
    }
    return 1;
}
Good but I only want it to work when I'm inside the car. What I have to do?
Reply
#10

pawn Код:
if(strcmp(cmdtext, "/destroycar", true) == 0)
{
    if(!IsPlayerAdmin(playerid)) return 1;
    DestroyVehicle(GetPlayerVehicleID(playerid));
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)