Anti-Car Flooding - 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)
+--- Thread: Anti-Car Flooding (
/showthread.php?tid=409576)
Anti-Car Flooding -
RiChArD_A - 22.01.2013
Hi I have a DM server and it has a car spawner sysyem by commands (Example: /sultan and a Sultan spawns) but recently a lot of nerds are just connecting to flood up the server with cars all over the place and its embarrassing because people think I mapped it like that

. So today what I want to ask is how do I set a limit of spawns a player can do? For example if I had already spawned 5 cars a message will say "You can't spawn any more cars do to anti-car flooding, please use one of the cars that are default with the map" Thank you everyone and please help.
Edit: Read my latest answers before replying.
Re: Anti-Car Flooding -
SomeRandomGuy123 - 22.01.2013
If a player already has one car spawned, tell them to despawn it before spawning a new one?
This is what I have in my script:
Code:
if(PlayerInfo[playerid][vModel] && PlayerInfo[playerid][vVModel])
{
format(string, sizeof(string), "You already have vehicle %d and %d spawned!", PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVVeh]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
Re: Anti-Car Flooding -
Jewell - 22.01.2013
use a SetTimer or do a variable like this..
pawn Code:
new MaxCars[MAX_PLAYERS];
pawn Code:
CMD:sultan(playerid){
MaxCars[playerid]++;
if(MaxCars[playerid]>5) return SendClientMessage(playerid, -1, "You can't spawn any more");
//your codes
return 1;
}
post your command then i can fix it for you.
Respuesta: Re: Anti-Car Flooding -
RiChArD_A - 22.01.2013
Quote:
Originally Posted by SomeRandomGuy123
If a player already has one car spawned, tell them to despawn it before spawning a new one?
This is what I have in my script:
Code:
if(PlayerInfo[playerid][vModel] && PlayerInfo[playerid][vVModel])
{
format(string, sizeof(string), "You already have vehicle %d and %d spawned!", PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVVeh]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
|
Mmm cool but where in my script I have tu put it?
AW: Anti-Car Flooding -
Blackazur - 22.01.2013
Try this:
https://sampforum.blast.hk/showthread.php?pid=1832467#pid1832467
Respuesta: AW: Anti-Car Flooding -
RiChArD_A - 22.01.2013
Quote:
Originally Posted by Blackazur
|
Yeah but with that they won't be allow to spawn any vehicule :/ (not really what I wanted)
PD: how do I put in my script what SomeRandomGay123 give me?
Re: Anti-Car Flooding -
ikey07 - 22.01.2013
pawn Code:
new PlayerCar[MAX_PLAYERS];
OnPlayerDisconnect(
if(PlayerCar[playerid] > 0) { DestroyVehicle(PlayerCar[playerid] ); PlayerCar[playerid] = 0; }
In cmd
if(PlayerCar[playerid] > 0) { DestroyVehicle(PlayerCar[playerid] ); }
PlayerCar[playerid] = CreateVehicle(..
Respuesta: Re: Anti-Car Flooding -
RiChArD_A - 22.01.2013
Quote:
Originally Posted by ikey07
pawn Code:
new PlayerCar[MAX_PLAYERS];
OnPlayerDisconnect(
if(PlayerCar[playerid] > 0) { DestroyVehicle(PlayerCar[playerid] ); PlayerCar[playerid] = 0; }
In cmd
if(PlayerCar[playerid] > 0) { DestroyVehicle(PlayerCar[playerid] ); } PlayerCar[playerid] = CreateVehicle(..
|
What this do its destroy the cars when the player disconnects?
Re: Anti-Car Flooding -
ikey07 - 22.01.2013
You dont want to keep car in your server if player disconnects, dont you?
Respuesta: Re: Anti-Car Flooding -
RiChArD_A - 23.01.2013
Quote:
Originally Posted by ikey07
pawn Code:
new PlayerCar[MAX_PLAYERS];
OnPlayerDisconnect(
if(PlayerCar[playerid] > 0) { DestroyVehicle(PlayerCar[playerid] ); PlayerCar[playerid] = 0; }
In cmd
if(PlayerCar[playerid] > 0) { DestroyVehicle(PlayerCar[playerid] ); } PlayerCar[playerid] = CreateVehicle(..
|
Where on my GM do I place this and what SomeRandomGay123 give me?
Aaaaaaa holy mother of god some one answer please I won't hurt you.