Thank you very much ! It works !
But I have got another problem. When I go to cement truck and load and unload, my friend can't load it. It says your cement truck is being loaded but the success message appears on me.
Here is the codes:
pawn Код:
if(strcmp("/betonal", cmdtext, true, 10) == 0)
{
new State=GetPlayerState(playerid);
new playervehicleid = GetPlayerVehicleID(playerid);
if(IsABeton(playervehicleid) && State == PLAYER_STATE_DRIVER)
{
if(PlayerInfo[playerid][pFaction] == 15)
{
if(PlayerToPoint(4.0, playerid, -262.0264,-2175.5125,29.0102))
{
BilgiMesajiGonder(playerid, " Please wait while taking cement ! ");
GameTextForPlayer(playerid, " ~r~ Cement is ~g~ Being ~w~ Taken !", 20000, 3);
SetTimer("BetonAlirkene", 20000, true);
BetonVarMi[playerid] = 1;
TogglePlayerControllable(playerid, 0);
}
}
}
else if(!IsABeton(playervehicleid) && State == PLAYER_STATE_DRIVER)
{
HataMesajiGonder(playerid, " You aren't in a cement truck or you are not the driver !");
}
return 1;
}
and:
pawn Код:
new BetonVarMi[MAX_PLAYERS];
forward BetonDokerkene(playerid);
forward BetonAlirkene(playerid);
aaand:
pawn Код:
public BetonAlirkene(playerid)
{
TogglePlayerControllable(playerid, 1);
BilgiMesajiGonder(playerid, " Cement was successfully taken !");
return 1;
}
public BetonDokerkene(playerid)
{
TogglePlayerControllable(playerid, 1);
BilgiMesajiGonder(playerid, " Cement was succesfully unloaded !");
return 1;
}
and this is the unloading command which has the same bug:
pawn Код:
if(strcmp("/betondok", cmdtext, true, 10) == 0)
{
new State=GetPlayerState(playerid);
new playervehicleid = GetPlayerVehicleID(playerid);
if(IsABeton(playervehicleid) && State == PLAYER_STATE_DRIVER)
{
if(BetonVarMi[playerid] == 1)
{
SetTimer("BetonDokerkene", 20000, true);
TogglePlayerControllable(playerid, 0);
BilgiMesajiGonder(playerid, " Please wait while the cement is being unloaded ! ");
GameTextForPlayer(playerid, " ~r~ Cement is ~g~ Being ~w~ Unloaded!", 20000, 3);
BetonVarMi[playerid] = 0;
}
}
else if(BetonVarMi[playerid] == 0)
{
HataMesajiGonder(playerid, " Please load cement first ! ");
}
else if(!IsABeton(playervehicleid) && State == PLAYER_STATE_DRIVER)
{
HataMesajiGonder(playerid, " You are not in the cement truck or you are not the driver !");
}
return 1;
}
BTW HataMesajiGonder and BilgiMesajiGonder are scripted functions in my gamemode.