Only Donator car. - 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: Only Donator car. (
/showthread.php?tid=464359)
Only Donator car. -
dino_d_carter - 16.09.2013
Hey guys i was looking for this information but i dint find anything, how can i make so all nrg 500 is only for donators? i dint mean then like
Код:
new donatorcar;
donatorcar = AddStatisticVehicle..
I want to make it on player state change but idk how? anyone who can?
Re: Only Donator car. -
DanishHaq - 16.09.2013
Put it under OnPlayerStateChange, if the new state is PLAYER_STATE_DRIVER and the vehicleid is donatorcar and the player is not a donator, use RemovePlayerFromVehicle(playerid); to remove him from the car.
Re: Only Donator car. -
dino_d_carter - 16.09.2013
Quote:
Originally Posted by DanishHaq
Put it under OnPlayerStateChange, if the new state is PLAYER_STATE_DRIVER and the vehicleid is donatorcar and the player is not a donator, use RemovePlayerFromVehicle(playerid); to remove him from the car.
|
Can u show me as a code please?
Re: Only Donator car. -
dino_d_carter - 17.09.2013
Sry for bump but anyone who can help me?
Re: Only Donator car. -
Konstantinos - 17.09.2013
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if( newstate == PLAYER_STATE_DRIVER )
{
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 522 && !IsPlayerDonator( playerid ) )
{
RemovePlayerFromVehicle( playerid );
SendClientMessage( playerid, -1, "Only donators can drive a nrg-500!" );
}
}
return 1;
}
NOTE: Change
!IsPlayerDonator(playerid) with your variable about checking whether they're donators or not.
Re: Only Donator car. -
alinategh - 17.09.2013
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(DonatorsVehicle(vehicleid))
{
if(pInfo[playerid][donator] >= 1) return 1;
else return RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
You need to have a script for it to see if the vehicle is for donators or not. a Function.
Re: Only Donator car. -
dino_d_carter - 17.09.2013
Quote:
Originally Posted by Konstantinos
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate ) { if( newstate == PLAYER_STATE_DRIVER ) { if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 522 && !IsPlayerDonator( playerid ) ) { RemovePlayerFromVehicle( playerid ); SendClientMessage( playerid, -1, "Only donators can drive a nrg-500!" ); } } return 1; }
NOTE: Change !IsPlayerDonator(playerid) with your variable about checking whether they're donators or not.
|
Hey thanks for you answer but i got this errors :
Код:
C:\Users\Dino\Desktop\Raven's Roleplay 0.3x\gamemodes\larp.pwn(16431) : error 029: invalid expression, assumed zero
C:\Users\Dino\Desktop\Raven's Roleplay 0.3x\gamemodes\larp.pwn(16431 -- 16433) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
And this is what i typed in:
Код:
if( newstate == PLAYER_STATE_DRIVER )
{
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 522 && if(PlayerInfo[playerid][pDonator] == 1))
{
RemovePlayerFromVehicle( playerid );
SendClientMessage( playerid, COLOR_RED, "Only donators can drive a nrg-500!" );
}
}
The line problem is on If (getvehicle
Re: Only Donator car. -
Konstantinos - 17.09.2013
Change to:
pawn Код:
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 522 && PlayerInfo[playerid][pDonator] != 1 )
You used an if inside the other. Plus the code after that is for removing the player that they're not donator.
Assuming
PlayerInfo[playerid][pDonator] == 1 is donator, use != to check if they are not.
Re: Only Donator car. -
Pottus - 17.09.2013
I don't want to be too much of an ass but.... why are you wasting your time with Ravens Roleplay? It is one of the worst scripts on the forums.
Re: Only Donator car. -
dino_d_carter - 17.09.2013
Quote:
Originally Posted by Konstantinos
Change to:
pawn Код:
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 522 && PlayerInfo[playerid][pDonator] != 1 )
You used an if inside the other. Plus the code after that is for removing the player that they're not donator.
Assuming PlayerInfo[playerid][pDonator] == 1 is donator, use != to check if they are not.
|
Well it works fine if i had only one donator level but i have 3 donators levels ?