06.08.2012, 16:05
Hello,
I wanted help with this code:
I have two problems with this:
1:The timer does not end and the player is still in drunk Position.
2:Even if I do /seatbelton,when the player's car gets damaged,the player again apears to be drunk.I don't want this to happen if a player did /seatbelton.Please help.
I wanted help with this code:
PHP Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/seatbelton", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][seatbelt] = false)
{
PlayerInfo[playerid][seatbelt] = true;
SendClientMessage(playerid,0xFFFFFF,"You have succesfully put your seatbelt on.");
}
else
SendClientMessage(playerid,0xFFFFFF,"You already have your seatbelt on.");
}
else
SendClientMessage(playerid,0xFFFFFF,"You are not in a vehicle!");
}
if (strcmp("/seatbeltoff", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][seatbelt] = true)
{
PlayerInfo[playerid][seatbelt] = false;
SendClientMessage(playerid,0xFFFFFF,"You have succesfully put your seatbelt off.");
}
else
SendClientMessage(playerid,0xFFFFFF,"You already have your seatbelt off.");
}
else
SendClientMessage(playerid,0xFFFFFF,"You are not in a vehicle!");
}
return 0;
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
SetTimerEx("damage", 5000, false, "b", playerid);
return 1;
}
forward damage(playerid);
public damage(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][seatbelt] = true)
{
SetPlayerDrunkLevel(playerid,3000);
}
else
return 0;
}
else
return 0;
return 1;
}
1:The timer does not end and the player is still in drunk Position.
2:Even if I do /seatbelton,when the player's car gets damaged,the player again apears to be drunk.I don't want this to happen if a player did /seatbelton.Please help.