Which ? (PAWN Public ws New Public)
#9

Quote:
Originally Posted by introzen
View Post
What you're dealing with here is a native callback versus a function. In this case, when the player state changes. The function must be called by you in the script. Do realize that callbacks are regular functions aswell, but set to be called on some events by the SA-MP developer team.

And example of this would be the following.

PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
        
TaxiOrDestroy(playerid); //Call your function
    
}
    return 
1;

PHP Code:
TaxiOrDestroy(playerid) {
    new 
vehicleid GetPlayerVehicleID(playerid);
    new 
vehicle GetVehicleModel(vehicleid);
    if(
vehicle == 420) return SendClientMessage(playerid, -1"Welcome to the taxi.");;
    
DestroyVehicle(vehicleid);
    
SendClientMessage(playerid, -1"This is not a taxi. Destroying the vehicle.");
    return 
1;

Also, never use public on your own functions unless they need to be called at run time.
it is okay, i figured it out. Thanks for the explanation and examples.
i am grateful to everyone who helped ! Have a nice day..
Reply


Messages In This Thread
Which ? (PAWN Public ws New Public) - by ProRakNet - 25.04.2016, 18:45
Re: Which ? (PAWN Public ws New Public) - by CodeStyle175 - 25.04.2016, 19:00
Re: Which ? (PAWN Public ws New Public) - by iKevin - 25.04.2016, 19:07
Re: Which ? (PAWN Public ws New Public) - by ProRakNet - 25.04.2016, 19:29
Re: Which ? (PAWN Public ws New Public) - by ProRakNet - 25.04.2016, 19:33
Re: Which ? (PAWN Public ws New Public) - by CodeStyle175 - 25.04.2016, 22:35
Re: Which ? (PAWN Public ws New Public) - by Mauzen - 25.04.2016, 22:46
Re: Which ? (PAWN Public ws New Public) - by introzen - 26.04.2016, 07:41
Re: Which ? (PAWN Public ws New Public) - by ProRakNet - 26.04.2016, 09:19

Forum Jump:


Users browsing this thread: 1 Guest(s)