03.08.2014, 10:16
I have one problem with OnPlayerStateChange.. I made seatbelt/helmet system but the problem is when player fall from bike it says "you have unbuckled your seatbelt" it should say "you removed safety helmet"... - this was when code was OnPlayerExitVehicle
Now I moved code OnPlayerStateChange and it won't even say that I removed my helmet when I go off the bike..
All I want to do is when player fall off the bike it should say that player removed safety helmet.
Now I moved code OnPlayerStateChange and it won't even say that I removed my helmet when I go off the bike..
All I want to do is when player fall off the bike it should say that player removed safety helmet.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
new vehicleid = GetPlayerVehicleID(playerid);
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_EXIT_VEHICLE)
{
if(SeatBelt[playerid] == 1)
{
if(IsModelABike(vehicleid)) // Bike - helmet
{
SeatBelt[playerid] = 0;
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, helmet[0]); // Removing his helmet
if (Masked[playerid] == 1) format(string, sizeof(string), "*Stranger_%d removes the safety helmet.", maskid[playerid]);
else format(string, sizeof(string), "*%s removes the safety helmet.", sendername);
ProxDetector(8.0, playerid, string,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA);
return 1;
}
else // SEATBELT
{
SeatBelt[playerid] = 0;
if (Masked[playerid] == 1) format(string, sizeof(string), "*Stranger_%d unbuckles his seatbelt.", maskid[playerid]);
else format(string, sizeof(string), "*%s unbuckles his seatbelt.", sendername);
ProxDetector(8.0, playerid, string,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA);
}
}
}