[HELP] Delete the cars made by the command /v - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Delete the cars made by the command /v (
/showthread.php?tid=144120)
[HELP] Delete the cars made by the command /v -
J. - 25.04.2010
How to delete the cars made by the command /v
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
// DCMD DEFINE's
dcmd(help,4,cmdtext);
dcmd(s,1,cmdtext); // 1 = amount of character
dcmd(skin,4,cmdtext);
new cmd[256], tmp[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/v", true, 3) == 0)
{
new String[200];
new Float:x, Float:y, Float:z,Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE:/v <Vehicle NAME|ID>");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid,COLOR_RED, "ERROR: Invalid vehicle NAME/ID");
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_RED, "[VEHICLE]: You are already in a vehicle.");
return 1;
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 1);
}
new Vid = AddStaticVehicleEx(vehicle,x, y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid,Vid,0);
LinkVehicleToInterior(Vid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(Vid,GetPlayerVirtualWorld(playerid));
format(String, sizeof(String), "%s has spawned a %s (ID:%i - MODEL ID: %i)", GetPName(playerid),aVehicleNames[vehicle - 400],Vid, vehicle);
SendClientMessageToAll(COLOR_RED, String);
return 1;
}
return 0;
}
Код:
if(strcmp(cmdtext, "/dv", true) == 0)
{
new Vid;
Vid = GetPlayerVehicleID(playerid);
DestroyVehicle(Vid);
return 1;
}
Re: [HELP] Delete the cars made by the command /v -
Miguel - 25.04.2010
Make a variable to store the vehicle there and then delete it

.
pawn Код:
new MyVehicle[MAX_PLAYERS];
pawn Код:
MyVehicle[playerid] = CreateVehicle(411, 0.0, 0.0, 0.0, 0.0, -1, -1, -1);
pawn Код:
DestroyVehicle(MyVehicle[playerid]);
Re: [HELP] Delete the cars made by the command /v -
J. - 25.04.2010
SAWC™ if I create more than one they do not destroy vehicles only destroys the last one did.
How to destroy all vehicles made by the command /v.