SA-MP Forums Archive
Error help me !!! - 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: Error help me !!! (/showthread.php?tid=308389)



Error help me !!! - Artie_Scorpion - 03.01.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicles[MAX_PLAYERS][playerid] =
{
520, // hydra
593, // dodo
376, // rustler
432}; // rhino

    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
    //If they got into a car from being on foot.
        if( GetVehicleModel(GetPlayerVehicleID( playerid )) == vehicles)  //naudoti || masina ||
        {
            if( GetPlayerSkin(playerid) != 27) //naudoti || skinas ||

            {
                //If their skin is not 27
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti elektriku" );//-1
                return 1;
            }
            else
            {
                SendClientMessage(playerid, 0xFF000000, "Atsisedote i transporta. Jeigu dirbate, tada dirbkite savo darba");
                return 1;
            }
        }
    }
    return 1;
}
I've got a large error. It turning my pawno off... Just try and you will see. And help me to fix this.


Re: Error help me !!! - Kaperstone - 03.01.2012

try it this one:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicles[MAX_PLAYERS][playerid] =
{
520, // hydra
593, // dodo
376, // rustler
432
}; // rhino
    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
    //If they got into a car from being on foot.
        if( GetVehicleModel(GetPlayerVehicleID( playerid )) == vehicles)  //naudoti || masina ||
        {
            if( GetPlayerSkin(playerid) != 27) //naudoti || skinas ||

            {
                //If their skin is not 27
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti elektriku" );//-1
            }else{
                SendClientMessage(playerid, 0xFF000000, "Atsisedote i transporta. Jeigu dirbate, tada dirbkite savo darba");
            }
        }
    }
    return 1;
}



Re: Error help me !!! - Artie_Scorpion - 03.01.2012

Quote:
Originally Posted by xkirill
Посмотреть сообщение
try it this one:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicles[MAX_PLAYERS][playerid] =
{
520, // hydra
593, // dodo
376, // rustler
432
}; // rhino
    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
    //If they got into a car from being on foot.
        if( GetVehicleModel(GetPlayerVehicleID( playerid )) == vehicles)  //naudoti || masina ||
        {
            if( GetPlayerSkin(playerid) != 27) //naudoti || skinas ||

            {
                //If their skin is not 27
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti elektriku" );//-1
            }else{
                SendClientMessage(playerid, 0xFF000000, "Atsisedote i transporta. Jeigu dirbate, tada dirbkite savo darba");
            }
        }
    }
    return 1;
}
Same...


Re: Error help me !!! - FTLOG - 03.01.2012

So what exactly is this thing 'vehicles[ MAX_PLAYERS ][ playerid ]' ? This doesn't make any sense. If you want your scripts to work, you have to understand them first. Try this out -

Somewhere in your script

pawn Код:
CheckVehicle( vehicleid ) {

     switch( GetVehicleModel( vehicleid ) ) {

          case 520, 593, 376, 432: return true;

     }
     return false;
}
OnPlayerStateChange

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
    //If they got into a car from being on foot.
        if( CheckVehicle( GetPlayerVehicleID( playerid ) ) )  //naudoti || masina ||
        {
            if( GetPlayerSkin(playerid) != 27) //naudoti || skinas ||
            {
                //If their skin is not 27
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti elektriku" );//-1
            }
            else
            {
                SendClientMessage(playerid, 0xFF000000, "Atsisedote i transporta. Jeigu dirbate, tada dirbkite savo darba");
            }
        }
    }
    return 1;
}