SA-MP Forums Archive
DestroyVehicle - 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: DestroyVehicle (/showthread.php?tid=397109)



DestroyVehicle - Louris - 03.12.2012

Lines:

Код:
public OnVehicleSpawn(vehicleid)
{
if(DM[playerid] == true)
DestroyVehicle(currentveh);
	return 1;
}
Errors:

C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 241) : error 017: undefined symbol "playerid"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 242) : error 017: undefined symbol "currentveh"

If i write

new currentveh;
currentveh = GetPlayerVehicleID(playerid);

i get more errors:

C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 241) : error 017: undefined symbol "playerid"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 242) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 242) : error 017: undefined symbol "currentveh"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 242) : warning 215: expression has no effect
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 243) : error 017: undefined symbol "currentveh"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 243) : error 017: undefined symbol "playerid"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 244) : error 017: undefined symbol "currentveh"

I want to make that if player in DM zone, he can't spawn vehicles.



Re: DestroyVehicle - tsonn1 - 03.12.2012

Replace currentveh with vehicleid. That'll solve the currentveh problem.
Add DM under the vehicles enum too and replace the playerid with vehicleid.


Re: DestroyVehicle - Azazelo - 03.12.2012

Where is you "spawn car" part ?

Bather way is to forbid command if(DM[playerid] == true)

pawn Код:
public OnVehicleSpawn(vehicleid)
{
if(DM[playerid] == true)
DestroyVehicle(vehicleid);
    return 1;
}



Re: DestroyVehicle - [HK]Ryder[AN] - 03.12.2012

there is no playerid parameter in OnVehicleSpawn..you could do that in OnPlayerEnterVehicle


Re: DestroyVehicle - Louris - 03.12.2012

Azazelo, now i get this error C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 241) : error 017: undefined symbol "playerid"


Re: DestroyVehicle - [HK]Ryder[AN] - 03.12.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
there is no playerid parameter in OnVehicleSpawn..you could do that in OnPlayerEnterVehicle
Quote:
Originally Posted by Louris
Посмотреть сообщение
Azazelo, now i get this error C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 241) : error 017: undefined symbol "playerid"
4char


Re: DestroyVehicle - Louris - 03.12.2012

I try'ed in onplayerentervehicle, but vehicle destroys only when player enter vehicle, not when he spawn car..


Re: DestroyVehicle - Konstantinos - 03.12.2012

Use it on command.
pawn Код:
if( DM[ playerid ] == true ) return SendClientMessage( playerid, -1, "You cannot spawn a vehicle during DM!" );
// code for spawning vehicle
Or just
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
        if( DM[ playerid ] == true ) DestroyVehicle( GetPlayerVehicleID(playerid) );
    }
    return 1;
}



Re: DestroyVehicle - [HK]Ryder[AN] - 03.12.2012

yes..and thats the only thing that can happen..because there is NO playerid parameter in that callback so if you script anything related to "playerid" over there it will show an error cuz it doesnt know what the heck IS playerid


Re: DestroyVehicle - Azazelo - 03.12.2012

Quote:

Where is you "spawn car" part ?

Quote:

I want to make that if player in DM zone, he can't spawn vehicles.

How they spawn cars ? Command ?