10.03.2014, 23:42
Hello there. I made this little something for my server. When you write /nrg it create a nrg for admins ... anyway I also wanted to make a /destryoveh command to delete all the vehicles created by admins and only those CREATED BY ADMINS ... everything was fine but it also deletes the vehicles occupied and I don't want that ... anyone could check the destroy command and fix that? Thank you.
[What I want]: When I type /destroyveh I want to delete all the unoccupied vehicles made by admins.
[What I want]: When I type /destroyveh I want to delete all the unoccupied vehicles made by admins.
pawn Код:
YCMD:nrg(playerid, params[], help)
{
new aName[MAX_PLAYER_NAME], str[100];
if (help) return SendClientMessage(playerid, 0x808080FF, "/heal este folosit pentru a da viata unui player, necesita truse de prim ajutor.");
if(!PlayerInfo[playerid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "Nu esti admin");
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerPos(playerid,PlayerInfo[playerid][pPosx], PlayerInfo[playerid][pPosy], PlayerInfo[playerid][pPosz]);
gAdminVehID[gVehicleCounter] = CreateVehicle(522, PlayerInfo[playerid][pPosx], PlayerInfo[playerid][pPosy], PlayerInfo[playerid][pPosz], 0, 0,0,60000);
gVehicleCounter++;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
new zName[MAX_PLAYER_NAME], pFile[256];
GetPlayerName(i, zName, sizeof(zName));
format(pFile, sizeof(pFile), "Users\%s.ini", zName);
if (IsPlayerAdmin(i) || PlayerInfo[i][pAdmin] > 0)
{
format(str, sizeof(str), "Adminul %s a creat un NRG personal.", aName);
SendClientMessage(i, COLOR_RED, str);
}
}
}
return 1;
}
YCMD:destroyveh(playerid, params[], help)
{
new aName[MAX_PLAYER_NAME], str[100];
if (help) return SendClientMessage(playerid, 0x808080FF, "/heal este folosit pentru a da viata unui player, necesita truse de prim ajutor.");
if(!PlayerInfo[playerid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "Nu esti admin");
GetPlayerName(playerid, aName, sizeof(aName));
for(new i; i < gVehicleCounter; i++)
{
for (new u = 0; u < MAX_PLAYERS; u++)
{
if(!IsPlayerInVehicle(u, gAdminVehID[i]))
{
DestroyVehicle(gAdminVehID[i]);
}
}
}
gVehicleCounter = 0;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
new zName[MAX_PLAYER_NAME], pFile[256];
GetPlayerName(i, zName, sizeof(zName));
format(pFile, sizeof(pFile), "Users\%s.ini", zName);
if (IsPlayerAdmin(i) || PlayerInfo[i][pAdmin] > 0)
{
format(str, sizeof(str), "Vehiculele create de admini au fost sterse de %s.", aName);
SendClientMessage(i, COLOR_RED, str);
}
}
}
return 1;
}