SA-MP Forums Archive
What's wrong? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's wrong? (/showthread.php?tid=250960)



What's wrong? - Cjgogo - 25.04.2011

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       new classid;
       if(classid == 106)
       {
          new vehicleid=GetPlayerVehicleID(playerid);
          GetVehicleModel(vehicleid);
          if(GetVehicleModel(vehicleid) == 596)
          {
             SetPlayerWantedLevel(playerid,4);
             SendClientMessageToAll(RED,"%s has stolen a polcie car");
             SetPlayerColor(playerid,RED);
          }
       }
     }

    return 1;
}
I think the classid is the problem anyway help pelase


Re: What's wrong? - xir - 25.04.2011

Do you use gTeam?


Re: What's wrong? - [JnA]DukeNukem - 25.04.2011

hmmm

Code:
new vehicleid=GetPlayerVehicleID(playerid);
          GetVehicleModel(vehicleid);
in translation GetVehicleModel(vehicleid) = vehicleid = GetPlayerVehicleID


Re: What's wrong? - Cjgogo - 25.04.2011

well no i don't use yet but im thinking about using it


Re: What's wrong? - xir - 25.04.2011

Ok it's best to use it if you want to make Cops n Robbers, roleplay etc..

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       new classid;
       if(classid == 106)
       {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416)
            {
                SetPlayerWantedLevel(playerid,4);
                SendClientMessageToAll(RED,"%s has stolen a polcie car");
                SetPlayerColor(playerid,RED);
            }
        }
    }
    return 1;
}



Re: What's wrong? - aircombat - 25.04.2011

top of the script :
pawn Code:
new gClassid[MAX_PLAYERS];
under OnPlayerRequestClass :
pawn Code:
gClassid[playerid] = classid;
then use :
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       if(gClassid[playerid] == 106)
       {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416)
            {
                SetPlayerWantedLevel(playerid,4);
                SendClientMessageToAll(RED,"%s has stolen a police car");
                SetPlayerColor(playerid,RED);
            }
        }
    }
    return 1;
}
P.S : But u better use SetPlayerTeam or gTeam instead of class ids