DestroyVehicle
#1

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

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

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

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

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

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

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

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

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
Reply
#10

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 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)