SA-MP Forums Archive
no cars in here! - 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)
+--- Thread: no cars in here! (/showthread.php?tid=408868)



no cars in here! - RiChArD_A - 19.01.2013

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.


Re: no cars in here! - Mr.Anonymous - 19.01.2013

I think you can use IsPlayerInRangeOfPoint for that.


Respuesta: Re: no cars in here! - RiChArD_A - 19.01.2013

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


Re: no cars in here! - [ABK]Antonio - 19.01.2013

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.


Respuesta: Re: no cars in here! - RiChArD_A - 19.01.2013

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


Re: no cars in here! - Mr.Anonymous - 19.01.2013

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
}



Respuesta: Re: no cars in here! - RiChArD_A - 19.01.2013

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 )


Re: Respuesta: Re: no cars in here! - CodyCummings - 19.01.2013

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;
}



Respuesta: Re: Respuesta: Re: no cars in here! - RiChArD_A - 19.01.2013

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?


Re: no cars in here! - CodyCummings - 19.01.2013

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