Remove Bike Cmd Help -
alishvasis - 27.02.2014
Hi.I Make This Cmd For Remove All Bike In Server By Vehicle id 510
But Not Work Pls Fix It TnX(+ REP) THis CmD:
Код:
dcmd_removebike(playerid,params[])
{
#pragma unused params
if(GetVehicleModel(vehicleid) == 510 )
{
DestroyVehicle(vehicleid);
}
}
return 1;
}
Re: Remove Bike Cmd Help -
DexterC - 27.02.2014
pawn Код:
dcmd_removebike(playerid,params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 510)
{
DestroyVehicle(vehicleid);
}
return 1;
}
Re: Remove Bike Cmd Help -
alishvasis - 27.02.2014
Quote:
Originally Posted by DexterC
pawn Код:
dcmd_removebike(playerid,params[]) { new vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 510) { DestroyVehicle(vehicleid); } return 1; }
|
Not Work
Re: Remove Bike Cmd Help -
TLN - 27.02.2014
Try this one, works for me, but remember that you need to be inside the vehicle.
pawn Код:
dcmd_removebike(playerid,params[])
{
new Vehicle;
Vehicle = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 510)
{
DestroyVehicle(Vehicle);
}
return 1;
}
Re: Remove Bike Cmd Help -
PowerPC603 - 27.02.2014
To delete all existing bikes with model-id 510, use this code.
It loops through all vehicle-id's, checks if each one has model-id 510, and if it matches, it will be deleted.
pawn Код:
dcmd_removebike(playerid,params[])
{
#pragma unused params
for (new vid; vid < MAX_VEHICLES; vid++)
{
if (GetVehicleModel(vid) == 510)
DestroyVehicle(vid);
}
return 1;
}
Re: Remove Bike Cmd Help -
alishvasis - 28.02.2014
TnX PowerPC603 It Worked But How To Delet Three Model Vehicle?
Re: Remove Bike Cmd Help -
alishvasis - 28.02.2014
Quote:
Originally Posted by PowerPC603
To delete all existing bikes with model-id 510, use this code.
It loops through all vehicle-id's, checks if each one has model-id 510, and if it matches, it will be deleted.
pawn Код:
dcmd_removebike(playerid,params[]) { #pragma unused params for (new vid; vid < MAX_VEHICLES; vid++) { if (GetVehicleModel(vid) == 510) DestroyVehicle(vid); }
return 1; }
|
How To Use Three Model Vehicle For Delete?
i Use It But Not Work!
Код:
for (new vid; vid < MAX_VEHICLES; vid++)
{
if (GetVehicleModel(vid) == 510 && 555 && 522)
DestroyVehicle(vid);
}
}
return 1;
}
Any One Fix It TnX
Re: Remove Bike Cmd Help -
Dystans - 28.02.2014
Try this:
pawn Код:
dcmd_removebike(playerid, params[]) {
for(new vid; vid < MAX_VEHICLES; vid++) {
if(GetVehicleModel(vid) == 510 && GetVehicleModel(vid) == 555 && GetVehicleModel(vid) == 522) DestroyVehicle(vid);
}
return 1;
}
Re: Remove Bike Cmd Help -
PowerPC603 - 28.02.2014
pawn Код:
dcmd_removebike(playerid,params[])
{
#pragma unused params
// Loop through all vehicles
for (new vid; vid < MAX_VEHICLES; vid++)
{
// Check the vehicle-model
switch(GetVehicleModel(vid))
{
// If it's model-id 510, 522 or 555, delete the vehicle
case 510, 522, 555:
DestroyVehicle(vid);
}
}
return 1;
}
Quote:
Originally Posted by Dystans
Try this:
pawn Код:
dcmd_removebike(playerid, params[]) { for(new vid; vid < MAX_VEHICLES; vid++) { if(GetVehicleModel(vid) == 510 && GetVehicleModel(vid) == 555 && GetVehicleModel(vid) == 522) DestroyVehicle(vid); } return 1; }
|
This won't work, as your code checks if the vehicle is all three models at once.
You could use || instead of the &&.
For more than 2 options, it's better to use switch-case.
Your line could get very long using when you want to check for 10 model-id's for example and the compiler might complain (input line too long).
With switch, case, you only need to add an extra number and you're set.
Re: Remove Bike Cmd Help -
alishvasis - 28.02.2014
Tnx Distanc But Not Work And Power Pc TnX For This Its Work I Reped You <3