SA-MP Forums Archive
Admin Cars - 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: Admin Cars (/showthread.php?tid=372844)



Admin Cars - _Khaled_ - 28.08.2012

pawn Код:
dcmd_acar(playerid,params[])
{
   #pragma unused params
   new Float:X,Float:Y,Float:Z,Float:ROT;
    {
        GetPlayerFacingAngle(playerid,ROT);
        GetPlayerPos(playerid,X,Y,Z);
        CreateVehicle(411,3+X,Y,Z,ROT,5,5,0);
        return 1;
    }
}
for example I do it twice, I want a /destoryall command. and /destroy if in vehicle..

and a /v (carname) (color1) (color)2 command please,

Thanks


Re: Admin Cars - Lordzy - 28.08.2012

Command for destroying vehicle if player is in a vehicle.
pawn Код:
dcmd_destroyv(playerid,params[])
{
 #pragma unused params
   if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000, "You must be in a vehicle to use this command.");
   new pVeh;
   pVeh = GetPlayerVehicleID(playerid);
   DestroyVehicle(pVeh);
   return 1;
}
Sorry if mistakes are there,because Im doing this through my mobile.


Re: Admin Cars - _Khaled_ - 28.08.2012

Okay, can you show me a /v command?

EDIT: false command, it's not destroying the car.


Re: Admin Cars - Lordzy - 28.08.2012

pawn Код:
dcmd_v(playerid,params[])
{
 #pragma unused params
   new vehid;
   new color1;
   new color2;
   if(sscanf(params,"i",vehid,color1,color2)) return SendClientMessage(playerid, 0xFF0000, "Usage:/v [vehicleid] [color1] [color2]");
   new Float:x,Float:y,Float:z,Float:ang;
   GetPlayerFacingAngle(playerid,ang);
   GetPlayerPos(playerid,x,y,z);
   CreateVehicle(vehid,x+1,y+1,z+1,ang,color1,color2,60);
    return 1;
}
Sorry if mistakes are there.
Edit:This required sscanf plugin and include also.


Re: Admin Cars - _Khaled_ - 28.08.2012

I do have sscanf2


Re: Admin Cars - Jarnu - 28.08.2012

pawn Код:
CMD:dv(playerid, params[])
{
static
vehID
;
if ( sscanf( params, "i",  vehID ) )
return SendClientMessage( playerid, COLOR_RED, "SYNTAX: /dv < vehID >" );

if ( vehID == INVALID_VEHICLE_ID )
return SendClientMessage( playerid, COLOR_RED, "ERROR: Invalid vehicle ID." );

DestroyVehicle(vehID);
return 1;
}



Re: Admin Cars - Lordzy - 28.08.2012

Then no probs.
You can also use sscanf2.


Re: Admin Cars - _Khaled_ - 28.08.2012

It's not destroying the car, lol :P


Re: Admin Cars - Jarnu - 28.08.2012

my code will.. it works perfect for me.


Re: Admin Cars - _Khaled_ - 28.08.2012

Sorry Jarnu, did see your post x_x let me try it.
EDIT: can you do it if player in vehicle?