SA-MP Forums Archive
need a lil help - 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: need a lil help (/showthread.php?tid=375806)



need a lil help - XtremeR - 08.09.2012

i need help on OnPlayerStateChange

i made it like this :

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid;
if(newstate == PLAYER_STATE_DRIVER)
{
SetPlayerArmedWeapon(playerid, 0);
}
if(GetVehicleModel(vehicleid) == 425 && gClass[playerid] != PILOT_CLASS && gClass[playerid] != DONOR_CLASS)
{
SendClientMessage(playerid, RED,"ERROR: You need to be Pilot/Donor to drive Hunter");
RemovePlayerFromVehicle(playerid);
}

if(GetVehicleModel(vehicleid) == 520 && gClass[playerid] != PILOT_CLASS  && gClass[playerid] != DONOR_CLASS)
{

SendClientMessage(playerid, RED,"ERROR: You need to be Pilot/Donor to drive Hydra");
RemovePlayerFromVehicle(playerid);
}
if(GetVehicleModel(vehicleid) == 432 && gClass[playerid] != ENGINEER_CLASS  && gClass[playerid] != DONOR_CLASS)

{
SendClientMessage(playerid, RED,"ERROR: You need to be Engineer/Donor to drive Rhino");
RemovePlayerFromVehicle(playerid);
}

if(GetVehicleModel(vehicleid) == 447 && gClass[playerid] != PILOT_CLASS  && gClass[playerid] != DONOR_CLASS)

{
SendClientMessage(playerid, RED,"ERROR: You need to be Pilot/Donor to drive Sea-Sparrow");
RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
pawno is also not giving error or warning but when i go in game to test it doesnt works


Re: need a lil help - Smokkr - 08.09.2012

What error?Post it.


Re: need a lil help - StrangeLove - 08.09.2012

Whats the error or warning?


Re: need a lil help - leonardo1434 - 08.09.2012

this should work.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
      SetPlayerArmedWeapon(playerid, 0);
      switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
      {
          case 425,432,447,520:
          {
             if(gClass[playerid] != PILOT_CLASS || gClass[playerid] != DONOR_CLASS) return SendClientMessage(playerid, RED,"ERROR: You need to be Pilot/Donor to drive this vehicle"),RemovePlayerFromVehicle(playerid);
          }
      }
    }
    return 1;
}



Re: need a lil help - XtremeR - 08.09.2012

that didnt worked but ill make it work thanks +Repped

Edit: still not working please help


Re: need a lil help - XtremeR - 08.09.2012

please help me... i tried all things not working,