/vrespawn - 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: /vrespawn (
/showthread.php?tid=90152)
/vrespawn -
Anwix - 06.08.2009
So, i've got the command working, but once i type it ingame i get:
All Current unocupied vehicles have been respawned.
SERVER: Unknown Command
I know this is because of a 'return 1;' but once i add return 1; to the command the command no longer respawns cars.
Here is my code:
Help would be very nice.
Re: /vrespawn -
gtalover12 - 06.08.2009
Not tested
Код:
dcmd_vrespawn(playerid, params[])
{
#pragma unused params
if(IsPlayerConnected(playerid))
{
new aLevel = dini_Int(GetPlayer(playerid), "admin");
if (aLevel > 1)
{
new bool:CarNotWanted[MAX_VEHICLES];
for(new i=0; i <MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
CarNotWanted[GetPlayerVehicleID(i)]=true;
}
}
for(new v = 1; v <= MAX_VEHICLES; v++)
{
if(!CarNotWanted[v])
{
SetVehicleToRespawn(v);
}
}
SendClientMessageToAll(COLOR_ORANGE, "All current unocupied vehicles have been respawned.");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not admin.");
return 1;
}
}
return 1;
}
Should work..
Re: /vrespawn -
Anwix - 06.08.2009
Thanks for the reply, but this is still not working, now it wont display the 'All current unocupied vehicles have been respawn'.
Getting annoying :P
Re: /vrespawn -
gtalover12 - 06.08.2009
Ok, well i found this around the forums..
Код:
if(strcmp("/respawnallcars", cmdtext, true) == 0 || strcmp("/rac", cmdtext, true) == 0)
{
if(IsPlayerConnected(playerid)) {
if(PlayerInfo[playerid][Level] < 5) {
SendClientMessage(playerid, red, "Error: you are not authorized to use this command");
return 1;
}
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++) if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
for(new car = 1; car <= 268; car++) if(!unwanted[car]) SetVehicleToRespawn(car);
format(stringy, sizeof(stringy), "All unused cars have been respawned by %s", PlayerInfo[playerid][Name]);
SendClientMessageToAll(orange, stringy);
}
return 1;
}
Re: /vrespawn -
Anwix - 06.08.2009
Nice find, i just edited a little and its working perfect thanks!