OnPayerStateChange problem [+Rep]
#1

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
Reply
#2

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;

Reply
#3

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
Reply
#4

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

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
Reply
#6

bump
Reply
#7

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;

Reply
#8

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
Reply
#9

anyone?
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)