17.08.2016, 09:01
I Use DestroyVehicle Function But Not Work Good! If Player In Vehicles And Take A New Vehicle My Cmd Destroy His Vehicle And Spawn a New Vehicle So Worked! But If Player Exit The Vehicle And Spawn A New Vehicle Dont Destroy Current Vehicles I Need Destroy His Current Vehicles At The All Time Take a new Vehicle!
This Is My Script
And This Is My Ful Car Spawn CMd For Admins
Anyone Can Fix It ?
TnX So Much For Sa-mp Forum
This Is My Script
PHP код:
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);
PHP код:
COMMAND:vc(playerid, params[])
{
if(spawnn[playerid] == 0) return 1;
if(!adminLevel(playerid, 1))
return 0;
new tempCar[10], vsID, message[128];
if(sscanf(params, "s[10]", tempCar))
{
Usage(playerid, "vc(reate) <vehicle name>");
}
else
{
new Float:x, Float:y, Float:z, Float:a;
vsID = getVehicleModelFromName(tempCar);
if(vsID < 400 || vsID > 612)
{
Server(playerid, "Unknown vehicle name.");
}
else
{
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(vsID == 612)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
}
else
{
for(new i = 0; i < MAX_ADMIN_VEHICLES; i++)
{
if(!GM[adminV][i])
{
new currentveh; //<<<<<Not Work Good!
currentveh = GetPlayerVehicleID(playerid); //<<<<<Not Work Good!
DestroyVehicle(currentveh); //<<<<<Not Work Good!
GM[adminV][i] = CreateVehicle(vsID, x, y, z, a, random(255), random(255), 600000);
LinkVehicleToInterior(GM[adminV][i], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(GM[adminV][i], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, GM[adminV][i], 0);
format(message, sizeof(message), "You have spawned a "CHAT_YELLOW"%s"CHAT_WHITE".", vehicleNames[vsID - 400]);
Server(playerid, message);
break;
}
if(i == (MAX_ADMIN_VEHICLES - 1))
{
Server(playerid, "Too many admin vehicle has been respawned, type "CHAT_YELLOW"/respawnallav "CHAT_WHITE"to respawn all admin vehicle.");
}
}
}
}
}
return 1;
}
TnX So Much For Sa-mp Forum