Need fs or pawn : Respawncars all the server or anti car spaming in the air -
jesdynguyen - 11.08.2014
my sv is roleplay , now the troller come so many and make my server with car spaming , they focus all vehicle in server make them freeze in the air either make the server so lag ... Anyone can help i need cmd to respawn all vehicle or anti cheat that
Thanks to see my topic , hope your answer sorry bad english
Re: Need fs or pawn : Respawncars all the server or anti car spaming in the air -
Zezombia - 11.08.2014
Try something like this:
pawn Код:
for(new a = 0; a < MAX_VEHICLES; a++) {
new bool:o = false;
for(new b = 0; b < MAX_PLAYERS; b++) if(GetPlayerVehicleID(b) == a) o = true;
if(o == true) SetVehicleToRespawn(a);
}
Re: Need fs or pawn : Respawncars all the server or anti car spaming in the air -
jesdynguyen - 11.08.2014
How to add that , im newbie
please help me
Re: Need fs or pawn : Respawncars all the server or anti car spaming in the air -
Zezombia - 11.08.2014
You have a few options, you could set it on a timer, call it from a command, or whatever you would like to do.
For a timer:
pawn Код:
//top of script
forward ResetTimer();
//in OnGameModeInit
SetTimer("ResetTimer", 60000, 1); //1 second = 1000 milliseconds. 60000 = every 60 seconds
//at the bottom of script
public ResetTimer()
{
for(new a = 0; a < MAX_VEHICLES; a++) {
new bool:o = false;
for(new b = 0; b < MAX_PLAYERS; b++) if(GetPlayerVehicleID(b) == a) o = true;
if(o == true) SetVehicleToRespawn(a);
}
}
Or in a command:
pawn Код:
//in OnPlayerCommandText
if(strcmp("/resetcars", cmdtext, true) == 0)
{
for(new a = 0; a < MAX_VEHICLES; a++) {
new bool:o = false;
for(new b = 0; b < MAX_PLAYERS; b++) if(GetPlayerVehicleID(b) == a) o = true;
if(o == true) SetVehicleToRespawn(a);
}
return 1;
}
Re: Need fs or pawn : Respawncars all the server or anti car spaming in the air -
jesdynguyen - 11.08.2014
thanks a lot but...
error

i cant add your pawn
Re: Need fs or pawn : Respawncars all the server or anti car spaming in the air -
iFarbod - 11.08.2014
Quote:
Originally Posted by jesdynguyen
thanks a lot but...
error  i cant add your pawn
|
Do you have scripting experience? Or probably, you are using a downloaded GM?
pawn Код:
stock IsVehicleOccupied(vehicleid)
{
for(new i = 0; i != MAX_PLAYERS; ++i)
{
if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == 0) return 1;
}
return 0;
}
stock RespawnUnoccupiedVehicles()
{
for(new i = 1; i != MAX_VEHICLES; ++i)
{
if(!IsVehicleOccupied(i) && IsValidVehicle(i))
{
SetVehicleToRespawn(i);
}
}
}
In a cmd:
pawn Код:
CMD:respawnallcars(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid, 0xFF0000AA, "Not allowed to use this."), return 0;
RespawnUnoccupiedVehicles();
return 1;
}
Re: Need fs or pawn : Respawncars all the server or anti car spaming in the air -
jesdynguyen - 11.08.2014
im using gamemode roleplay , i just use gamemode available for open the server , iam not experience for scripting

can you teach me specified more than
can i send you a message
Re: Need fs or pawn : Respawncars all the server or anti car spaming in the air -
Zezombia - 11.08.2014
What is the error you where getting?