State Change - 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: State Change (
/showthread.php?tid=361577)
State Change -
Qur - 21.07.2012
Hey.. I'm having problem with this public..
in the options there's few..
1. the taxis - only taxi drivers can drive it (work)
2. the limo - only limo driver can drive it (work)
3. cops cars - only cops can drive it (work)
4. /engine message when enter a car (dont show up)
5. /seatbelt textdraw when enter a car - pessanger + driver (only pessanger works)
hope something can help me..
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new newcar = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsATaxi(newcar))
{
if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{
if(OnDuty[playerid]==0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_GREY,"You are not on duty!");
}
else if(OnDuty[playerid]==1)
{
SendClientMessage(playerid,COLOR_GREEN,"Use /help for more information");
}
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_GREY,"You are not a part of Taxi Company!");
}
}
if(IsALimo(newcar))
{
if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{
if(PlayerInfo[playerid][pRank] >= 4)
{
if(OnDuty[playerid]==0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_GREY,"You are not on duty!");
}
else if(OnDuty[playerid]==1)
{
SendClientMessage(playerid,COLOR_GREEN,"Use /help for more information");
}
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_GREY,"You are not a Limo Driver!");
}
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_GREY,"You are not a part of Taxi Company!");
}
}
if(IsACop(newcar))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
return 1;
}
else
{
new string[128];
new sendername[MAX_PLAYER_NAME];
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_GREY,"You are not a cop!");
SendClientMessage(playerid,COLOR_LIGHTRED,"The alarm system sent message to LSPD HQ!!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s tried to steal a police car!",sendername);
SendRadioMessage(1, COLOR_REDCOP, string);
}
return 1;
}
}
else if(newstate == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == 0)
{
SendClientMessage(playerid, COLOR_WHITE,"To start the engine use '/engine' ");
return 1;
}
}
else if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(seatbelt[playerid] == 0)
{
TextDrawShowForPlayer(playerid,SeatBelt);
return 1;
}
}
return 1;
}
btw.. i've tried a lot of things and a lot of changes..
and nothing seem to work ;/
Re : State Change -
lelemaster - 21.07.2012
Remove the 'else', only write if(...
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
Re: State Change -
leonardo1434 - 21.07.2012
@lelemaste the problem is not that, the problem is that he didn't told us what is going on.
Re: State Change -
Qur - 21.07.2012
already tried ;/
i'll test it again right now..
and the only problem that the /engine and /seatbelt for driver doesnt show up..