SA-MP Forums Archive
when player enter 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: when player enter car (/showthread.php?tid=338132)



when player enter car - TheDiscussionCafe - 29.04.2012

hi guys, i want wen player enters any vehicle, it say "drive safely!"

how i do this?


Re: when player enter car - WarriorEd22 - 29.04.2012

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new string[128];
    format(string, sizeof(string), "You are entering vehicle %i",vehicleid);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}



Re: when player enter car - JaKe Elite - 29.04.2012

use OnPlayerStateChange

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        SendClientMessage(playerid, -1, "Drive Safety!");
    }
    return 1;
}



Re: when player enter car - Ballu Miaa - 29.04.2012

Here fixed it as you want. Such add the define line on the top near all other color definitions.

pawn Код:
#define COLOR_GREEN           0x33AA33AA
//Add the above line on the top of all the other color definitions.

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        SendClientMessage(playerid, COLOR_GREEN, "Drive Safely!");
    GameTextForPlayer(playerid, "~g~Drive Safely", 1000, 3);
    }
    return 1;
}