SA-MP Forums Archive
Help with license (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: Help with license (rep+) (/showthread.php?tid=338659)



Help with license (rep+) - boyan96 - 30.04.2012

How i can make this only for plane or boats

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
     if(
LicenseInfo[playerid][Car] < 1)
     {
     
SendClientMessage(playerid0xFF6347AA"You can't drive this car, you don't have a license!");
     
RemovePlayerFromVehicle(playerid);
     return 
1; }
 }
    return 
1;

If you need i will paste the all script


Re: Help with license (rep+) - Kitten - 30.04.2012

Get all the vehicle ids for boats/planes, then use GetVehicleModel.


Re: Help with license (rep+) - ViniBorn - 30.04.2012

Use GetVehicleModel


Re: Help with license (rep+) - boyan96 - 30.04.2012

Can you show me an example with boat id 430 and plane 447


Re: Help with license (rep+) - boyan96 - 30.04.2012

someone please


Re: Help with license (rep+) - Face9000 - 30.04.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
     if(LicenseInfo[playerid][Car] < 1)
     {
      switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
      {
      case 430, 447: //Vehicle IDs.
      SendClientMessage(playerid, 0xFF6347AA, "You can't drive this car, you don't have a license!");
      RemovePlayerFromVehicle(playerid);
      }
      }
      }
      return 1;
     }
    return 1;
}
Sorry for the bad identation.


Re: Help with license (rep+) - boyan96 - 30.04.2012

i have this two errors
C:\Users\user\Desktop\license.pwn(70) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\user\Desktop\license.pwn(70) : warning 215: expression has no effect
C:\Users\user\Desktop\license.pwn(74) : error 010: invalid function or declaration


Line of Error (70)

PHP код:
RemovePlayerFromVehicle(playerid); 

Line of Error (74)
PHP код:
      return 1



Re: Help with license (rep+) - ViniBorn - 30.04.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(LicenseInfo[playerid][Car] < 1)
        {
            switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
            {
                case 430, 447: //Vehicle IDs.
                {
                    SendClientMessage(playerid, 0xFF6347AA, "You can't drive this car, you don't have a license!");
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
    return 1;
}