19.01.2013, 17:31
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.
I think you can use IsPlayerInRangeOfPoint for that.
|
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)
}
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
}
Just under your car command. Something like this
pawn Код:
|
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 )
|
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;
}
pawn Код:
|
if(strcmp(cmdtext, "/destroycar", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 1;
DestroyVehicle(GetPlayerVehicleID(playerid));
return 1;
}