OnPlayerKeyStateChange - gametext
#1

as I press the right button, I get the message "non stai guidando un veicolo"
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
PRESSED(KEY_HANDBRAKE))
    {
    new 
enginelightsalarmdoorsbonnetbootobjectivevehicleidstring[128];
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"Non hai effettuato il log-in.");
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_GREY"Non stai guidando un veicolo.");
    if(
vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playeridCOLOR_GREY"Bicycles have no engine.");
    
vehicleid GetPlayerVehicleID(playerid);
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    if(!
engine)
    {
        
SetVehicleParamsEx(vehicleid1lightsalarmdoorsbonnetbootobjective);
        if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
        {
SetVehicleParamsEx(vehicleid1lightsalarmPlayerInfo[playerid][vLocked], bonnetbootobjective);}
        else if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
        {
SetVehicleParamsEx(vehicleid1lightsalarmPlayerInfo[playerid][vVLocked], bonnetbootobjective);}
         else if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVVeh])
        {
SetVehicleParamsEx(vehicleid1lightsalarmPlayerInfo[playerid][vVVLocked], bonnetbootobjective);}
        
format(stringsizeof(string), "* %s gira la chiave ed accende il motore del veicolo."RPN(playerid));
         
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
         }
    if (
PRESSED (KEY_FIRE))
    {
      
SetVehicleParamsEx(vehicleid0lightsalarmdoorsbonnetbootobjective);
        if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
        {
SetVehicleParamsEx(vehicleid0lightsalarmPlayerInfo[playerid][vLocked], bonnetbootobjective);}
        if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
        {
SetVehicleParamsEx(vehicleid0lightsalarmPlayerInfo[playerid][vVLocked], bonnetbootobjective);}
         if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVVeh])
        {
SetVehicleParamsEx(vehicleid0lightsalarmPlayerInfo[playerid][vVVLocked], bonnetbootobjective);}
        
format(stringsizeof(string), "* %s gira la chiave e spegne il motore del veicolo."RPN(playerid));
         
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            }
    } 
And if I replace
PHP код:
 "if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Non stai guidando un veicolo.");" 
with
PHP код:
 "if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) 
when I press the right button of the mouse out of a vehicle, it tells me "Name_Surname gira la chiave e accende il motore del veicolo"

About the gametext ...
I would like to make is that once a player is on top of a pickup icon, appeared to him a gametext. I tried to put the gametext under onplayerconnect ... don't work.
I also set the range ... but no, it does not work.

PHP код:
public OnPlayerConnect(playerid)
{
 if(
IsPlayerInRangeOfPoint(playerid1.51247.6791,-1559.9728,13.5555))
    {
        
GameTextForPlayer(playerid"Digita ~r~ /esame~w~  per una lista delle license acquistabili."50005);
    } 
Reply
#2

You cannot use it in OnPlayerConnect as the player is not spawned at all.

If it's a pickup, why don't you use OnPlayerPickUpPickup callback instead?
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)