18.12.2013, 13:25
Hello!
When I use /veh it spawns me a vehicle,and when i get out from vehicle and i use command /respawnallc (respawn all cars) it respawn all vehicles but the vehicle which i spawned using command /veh respawn at the place where i left it.I would like that when I respawn all vehicles also vehicles from command /veh would be respawned (deleted).
HERE are the both commands,so please if someone could fix it.I dont know how to fix it.
CMD :respawnallc
CMD :veh
When I use /veh it spawns me a vehicle,and when i get out from vehicle and i use command /respawnallc (respawn all cars) it respawn all vehicles but the vehicle which i spawned using command /veh respawn at the place where i left it.I would like that when I respawn all vehicles also vehicles from command /veh would be respawned (deleted).
HERE are the both commands,so please if someone could fix it.I dont know how to fix it.
CMD :respawnallc
Код:
CMD:respawnallc(playerid, params[])
{
#pragma unused params
if(pInfo[playerid][Adminlevel] < 4)return SendClientMessage(playerid,COLOR_RED,"[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command.");
{
new bool:vehicleused[MAX_VEHICLES];
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
vehicleused[GetPlayerVehicleID(i)] = true;
}
}
for(new i=1; i < MAX_VEHICLES; i++)
{
if(!vehicleused[i])
{
SetVehicleToRespawn(i);
}
}
new msg[128], pName[MAX_PLAYERS];
GetPlayerName(playerid, pName, sizeof(pName));
format(msg, sizeof(msg), "[ADMIN]{FFFFFF} %s has respawned all unused vehicles.", pName);
SendClientMessageToAll(COLOR_ADMIN, msg);
}
return 1;
}
Код:
CMD:veh(playerid,params[])
{
if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid,COLOR_RED,"[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command.");
{
new car;
new string[128];
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
if(sscanf(params,"i", car)) return SendClientMessage(playerid,0xff0000ff,"USAGE: /Veh <Vehicle ID 400 - 611>");
else if(car < 400 || car >611) return SendClientMessage(playerid, 0xff0000ff, "ERROR: Cannot go under 400 or above 611.");
{
if(Vehicle[playerid] != 0)
{
DestroyVehicle(Vehicle[playerid]);
}
Vehicle[playerid] = CreateVehicle(car, X, Y, Z + 2.0, 0, -1, -1, 1);
format(string,sizeof(string),"You Have Spawned Vehicle ID %i",car);
SendClientMessage(playerid, 0xffffffff, string);
PutPlayerInVehicle(playerid, Vehicle[playerid], 0);
}
}
return 1;
}


