Anti-Car Flooding
#1

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.
Reply
#2

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;
		}
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by SomeRandomGuy123
View Post
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?
Reply
#5

Try this:

https://sampforum.blast.hk/showthread.php?pid=1832467#pid1832467
Reply
#6

Quote:
Originally Posted by Blackazur
View Post
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?
Reply
#7

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(..
Reply
#8

Quote:
Originally Posted by ikey07
View Post
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?
Reply
#9

You dont want to keep car in your server if player disconnects, dont you?
Reply
#10

Quote:
Originally Posted by ikey07
View Post
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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)