/vrespawn help - 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 help (
/showthread.php?tid=242798)
/vrespawn help -
tanush - 20.03.2011
Well i made /vrespawn so if admin uses it. Vehicles that is not used will be respawn and if players are driving vehicle, nothing will happen! when i use the cmd while im driving vehicle, the vehicle respawns
pawn Код:
CMD:vrespawn(playerid, params[])
{
if(PlayerData[playerid][AdminLevel] > 1)
{
for(new v = 1; v <= MAX_VEHICLES; v++)
{
SetVehicleToRespawn(v);
}
SendClientMessage(playerid,0xFF9900AA,"SERVER: An Administrator has respawned all vehicle!");
}
else return SendClientMessage(playerid,0xFF0000FF,"ERROR: Your admin level isn't high enough!");
return 1;
}
Re: /vrespawn help -
iJumbo - 20.03.2011
i think you have 2 make a loop to all player to and check if player is state driver or not
Re: /vrespawn help -
tanush - 20.03.2011
ok i did
pawn Код:
CMD:vrespawn(playerid, params[])
{
if(PlayerData[playerid][AdminLevel] > 1)
{
for(new v = 1; v <= MAX_VEHICLES; v++)
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
SetVehicleToRespawn(v);
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
}
SendClientMessage(playerid,0xFF9900AA,"SERVER: An Administrator has respawned all vehicle!");
}
else return SendClientMessage(playerid,0xFF0000FF,"ERROR: Your admin level isn't high enough!");
return 1;
}
but when im in a vehicle and do /vrespawn, vehicles that are not used doesnt respawn
Re: /vrespawn help -
Biesmen - 20.03.2011
Ofcourse not, you didn't make a loop, you made it check for the player who types /vrespawn only.
Try this:
pawn Код:
CMD:vrespawn(playerid, params[])
{
new Unusedcar[MAX_VEHICLES];
if(PlayerData[playerid][AdminLevel] > 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(i))
{
Unused[GetPlayerVehicleID(i)]=1; // 1 = false, which means it's used
}
}
}
for(new carid = 0; carid < MAX_VEHICLES; carid++)
{
if(unused[carid]==0) // 0 = true which means it's unused.
{
SetVehicleToRespawn(carid);
}
}
}
return 1;
}
Re: /vrespawn help -
Davz*|*Criss - 20.03.2011
pawn Код:
CMD:resetv(playerid, params[])
{
SendClientMessage(playerid, 0xFFFF00AA, "|- Your have Successfully Respawned all Vehicles!");
GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned!", 3000,3);
for(new cars=0; cars<MAX_VEHICLES; cars++)
{
if(!VehicleOccupied(cars))
{
SetVehicleToRespawn(cars);
}
}
SendClientMessage(playerid, 0xFFFF00AA, "All vehicles has been respawned, Please do not abuse this command unless all agrees to respawn.");
}
return 1;
}
And this somewhere in ya script:-
pawn Код:
public VehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
Re: /vrespawn help -
[ProX]BlueFire - 20.03.2011
1 error and 1 warrning
Код:
C:\Documents and Settings\galina\щемзп дтбегд\ъйчйдщм чйшйм\server\filterscripts\car.pwn(57) : error 010: invalid function or declaration
C:\Documents and Settings\galina\щемзп дтбегд\ъйчйдщм чйшйм\server\filterscripts\car.pwn(59) : warning 235: public function lacks forward declaration (symbol "VehicleOccupied")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: /vrespawn help -
tanush - 20.03.2011
its already fixed by Biesam, dave. Thmx