SA-MP Forums Archive
OnPayerStateChange problem [+Rep] - 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: OnPayerStateChange problem [+Rep] (/showthread.php?tid=585374)



OnPayerStateChange problem [+Rep] - simo0000 - 13.08.2015

i have a problem with OnPayerStateChange callback when someone drives hunter nothing happens how to fix that
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[128];
    new carid = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(carid == 425 && GetPVarInt(playerid, "_Stunt") == 1)
    {
        format(string,sizeof(string),"* {FFFFFF}%s {F68600}Has Got the hunter ", PlayerName(playerid));
        SendClientMessageToAll(COLOR_ADMIN, string);
    }
    return 1;
}
nothing happens when someone got the hunter
plz help and thnx
sorry for my bad english


Re: OnPayerStateChange problem [+Rep] - PMH - 13.08.2015

Are you sure that player's _Stunt PVar is 1?
also try this. it may work

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        new 
string[128];
        new 
carid GetVehicleModel(GetPlayerVehicleID(playerid));
        if(
carid == 425 && GetPVarInt(playerid"_Stunt") == 1)
        {
            
format(string,sizeof(string),"* {FFFFFF}%s {F68600}Has Got the hunter "PlayerName(playerid));
            
SendClientMessageToAll(COLOR_ADMINstring);
        }
    }
    return 
1;




Re: OnPayerStateChange problem [+Rep] - simo0000 - 13.08.2015

Quote:
Originally Posted by PMH
Посмотреть сообщение
Are you sure that player's _Stunt PVar is 1?
yes bro and i already remove it but same problem


Re: OnPayerStateChange problem [+Rep] - PMH - 13.08.2015

Quote:
Originally Posted by simo0000
Посмотреть сообщение
yes bro and i already remove it but same problem
try the code i posted, it may work then


Re: OnPayerStateChange problem [+Rep] - simo0000 - 13.08.2015

Quote:
Originally Posted by PMH
Посмотреть сообщение
Are you sure that player's _Stunt PVar is 1?
also try this. it may work

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        new 
string[128];
        new 
carid GetVehicleModel(GetPlayerVehicleID(playerid));
        if(
carid == 425 && GetPVarInt(playerid"_Stunt") == 1)
        {
            
format(string,sizeof(string),"* {FFFFFF}%s {F68600}Has Got the hunter "PlayerName(playerid));
            
SendClientMessageToAll(COLOR_ADMINstring);
        }
    }
    return 
1;

same :/ plz help


Re: OnPayerStateChange problem [+Rep] - simo0000 - 13.08.2015

bump


Re: OnPayerStateChange problem [+Rep] - PMH - 13.08.2015

With the code you provided, it should work fine as far as i know..
well might be a problem with ur callback so try it in this callback, better to use it like this:
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    new 
string[128];
    new 
carid GetVehicleModel(vehicleid);
    if(
carid == 425 && GetPVarInt(playerid"_Stunt") == && ispassenger == 0)
    {
        
format(string,sizeof(string),"* {FFFFFF}%s {F68600}Has Got the hunter "PlayerName(playerid));
        
SendClientMessageToAll(COLOR_ADMINstring);
    }
    return 
1;




Re: OnPayerStateChange problem [+Rep] - simo0000 - 13.08.2015

Quote:
Originally Posted by PMH
Посмотреть сообщение
With the code you provided, it should work fine as far as i know..
well might be a problem with ur callback so try it in this callback, better to use it like this:
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    new 
string[128];
    new 
carid GetVehicleModel(vehicleid);
    if(
carid == 425 && GetPVarInt(playerid"_Stunt") == && ispassenger == 0)
    {
        
format(string,sizeof(string),"* {FFFFFF}%s {F68600}Has Got the hunter "PlayerName(playerid));
        
SendClientMessageToAll(COLOR_ADMINstring);
    }
    return 
1;

not working


Re: OnPayerStateChange problem [+Rep] - simo0000 - 13.08.2015

anyone?


Re: OnPayerStateChange problem [+Rep] - LetsOWN[PL] - 13.08.2015

Just for debugging purposes..
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    printf("%d / %d / %d", GetVehicleMode(vehicleid), GetPVarInt(playerid, "_Stunt"), ispassenger);
    return 1;
}
What server prints out?

Greetings.