SA-MP Forums Archive
In vehicle Message? - 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: In vehicle Message? (/showthread.php?tid=606360)



In vehicle Message? - PrednizoN - 03.05.2016

only inside the car show message player

Код:
format(str, sizeof(str), "%s(%d) isimli araз %s(%d) tarafından tamir edildi.", vehName[GetVehicleModel(vID) - 400], vID,PlayerName, playerid);
	BilgiMesajiGonder(playerid, str);



Re: In vehicle Message? - kaisersouse - 03.05.2016

Use OnPlayerStateChange. If you were thinking of using OnPlayerEnterVehicle or OnPlayerExitVehicle...those are unreliable for doing anything to players who are STAYING in a vehicle. Since you can cancel enter/exiting a car, OnPlayerEnter/Exit is good for things like "player such and such opened your car" or something.

Anyways...

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) // Player entered a vehicle as a driver OR passenger
    {
        format(str, sizeof(str), "%s(%d) isimli araз %s(%d) tarafından tamir edildi.", vehName[GetVehicleModel(vID) - 400], vID,PlayerName, playerid);
	BilgiMesajiGonder(playerid, str);
    }
/* 
// I added this stuff below in case you want to do anything when they switch from being in a car, to being on-foot/respawning (which is another version of being on-foot)
    else if(newstate == PLAYER_STATE_ON_FOOT || newstate == PLAYER_STATE_SPAWNED)
    {
	BilgiMesajiGonder(playerid, "You are now on-foot");
    }
*/

    return 1;
}