SA-MP Forums Archive
Vehicle in DM zone - 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: Vehicle in DM zone (/showthread.php?tid=416524)



Vehicle in DM zone - Louris - 17.02.2013

How to make that if player in dm zone, he cant spawn vehicle? I maked this code:

Код:
public OnVehicleSpawn(vehicleid)
{
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( IsPlayerConnected( i ) && !IsPlayerNPC( i ) && DM[ i ] == true ) DestroyVehicle( vehicleid );

    }
	return 1;
}
But when someone enter dm zone, all player's can't spawn cars. If I try to make something with playerid, I get error undefined symbol playerid.


Re: Vehicle in DM zone - MP2 - 17.02.2013

Instead of destroying it when it spawns*, why not just prevent them from spawning it in the first place..?

*OnVehicleSpawn is called when a vehicle RE-spawns, not on initial creation (though my include vfunc adds 'OnVehicleCreated'). This won't do anything anyway.


Re: Vehicle in DM zone - Louris - 17.02.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
Instead of destroying it when it spawns*, why not just prevent them from spawning it in the first place..?

*OnVehicleSpawn is called when a vehicle RE-spawns, not on initial creation (though my include vfunc adds 'OnVehicleCreated'). This won't do anything anyway.
It work's, it destroy vehicle when someone in dm zone. How to prevent from spawning in the first place ?


Re: Vehicle in DM zone - ]Rafaellos[ - 17.02.2013

Try using your DM Zone in other Virtual World, so you can prevent it without extra plugins or includes.


Re: Vehicle in DM zone - Louris - 17.02.2013

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Try using your DM Zone in other Virtual World, so you can prevent it without extra plugins or includes.
I maked that, but it still spawn cars.


Re: Vehicle in DM zone - ]Rafaellos[ - 17.02.2013

Did you add: "if(GetPlayerVirtualWorld(playerid) > 0) return SendClientMessage(playerid, -1, "You can't spawn Cars in DM.");" in your car spawn command?