SA-MP Forums Archive
Spawn and delete cars of factions with commands - 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: Spawn and delete cars of factions with commands (/showthread.php?tid=242410)



Spawn and delete cars of factions with commands - ThomasTailor93 - 20.03.2011

Good evening,

I made a command to spawn cars for factions.

if(strcmp(cmd,"/fcar", true) == 0)
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,1553.5222,-1694.3353,6.218)
{
new Buyitems[] = "Streifenwagen\nRanger\nRancher\nMotorrad";
ShowPlayerDialog(playerid,3020,DIALOG_STYLE_LIST," Fraktionsfahrzeug",Buyitems,"Nehmen","Abbrechen");
}
}
return 1;
}

When I choose one item of the list, on example the "Streifenwagen" (cop car) the cop car spawns at the following position with an Numberplate (fixed in my script):


//==================================FAHRZEUGSPAWNER FЬR FRAKTIONEN==========================
if(dialogid == 3020) //LSPD
{
if(response)
{
if(listitem == 0) //Streifenwagen
{
CopCar[28] = CreateVehicle(596,1547.4124,-1693.4767,5.6128,179.8638,15,125,-1);
SetVehicleNumberPlate(CopCar, "TEST1");
SetVehicleToRespawn(CopCar);
}
else if(listitem == 1) //Ranger
{
CopCar[29] = CreateVehicle(599,1547.4124,-1693.4767,5.6128,179.8638,125,15,-1);
SetVehicleNumberPlate(CopCar, "TEST2");
SetVehicleToRespawn(CopCar);
}
else if(listitem == 2) //Rancher
{
CopCar[30] = CreateVehicle(490,1547.4124,-1693.4767,5.6128,179.8638,125,15,-1);
SetVehicleNumberPlate(CopCar, "TEST3");
SetVehicleToRespawn(CopCar);
}
else if(listitem == 3) //Motorrad
{
CopCar[31] = CreateVehicle(523,1547.4124,-1693.4767,5.6128,179.8638,15,125,-1);
SetVehicleNumberPlate(CopCar, "TEST4");
SetVehicleToRespawn(CopCar);
}
}
}
//==================================FAHRZEUGSPAWNER FЬR FRAKTIONEN==========================


Now I have spawned the car. It has spawned by no special player. This car can't be deleted. Now I want to script a command, that a car spawned at the position XYZ by ID XY. ID XY should be delete this car by command "/delfcar" but in the way, that the car, that ID XX has spawned for hisself, not be deleted. So in short way: ID XY spawned a car with "/fcar". ID XX spawned a car too. ID XY don't need the car. He used the command "/delfcar". His deleted his car. The car of ID XX shouldn't be deleted. I think its a "playerid" specific way but I don't know how to script. I'm a starter with scripting. I hope you understand me. Hope for help

Regards, ThomasTailor93


PS: I don't know the Pawno tags -.- ^^


Re: Spawn and delete cars of factions with commands - ThomasTailor93 - 20.03.2011

Is there nobody how can help me?


Re: Spawn and delete cars of factions with commands - Markx - 20.03.2011

use [ pawn ] [ / pawn ]


Re: Spawn and delete cars of factions with commands - Roomeo - 20.03.2011

well i don't understand your Question


Re: Spawn and delete cars of factions with commands - ThomasTailor93 - 20.03.2011

I have solved it. Can be closed!