02.11.2017, 20:32
So,i am making trucking server and i have problem with this timer.
Unloading works perfect before if statement. if(PlayerInfo[playerid][pCompany] == 1) etc. only checks for ID 0, it's seems that for other players only works this part
I have forwarded
Other codes:
Loading timer:
Checkpoint:
Please help
PHP код:
forward unloading(playerid);
public unloading(playerid)
{
new gString[128];//A new string for storage
new playerscore;
new moneymsg[20];
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");//sends the player a message
format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);//formats the message
SendClientMessageToAll(COLOR_GREEN, gString);//sends everyone message saying player completed mission
MissionStatus[playerid] = 0;//sets the mission status of the player to '0'
playerscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, playerscore+1);
GivePlayerMoney(playerid, iPay[playerid]);
format(moneymsg, sizeof(moneymsg), "~y~+%d~g~$", iPay[playerid]);
GameTextForPlayer(playerid, moneymsg, 5000, 1);
if(PlayerInfo[playerid][pCompany] == 1)
{
SendClientMessage(playerid, COL_POSITIVE, "Company bonus money: 3000$");
GivePlayerMoney(playerid, 3000);
}
else if(PlayerInfo[playerid][pCompany] == 2)
{
SendClientMessage(playerid, COL_POSITIVE, "Company bonus money: 6000$");
GivePlayerMoney(playerid, 6000);
}
else if(PlayerInfo[playerid][pCompany] == 3)
{
SendClientMessage(playerid, COL_POSITIVE, "Company bonus money: 12000$");
GivePlayerMoney(playerid, 12000);
}
return 1;
}
PHP код:
public unloading(playerid)
{
new gString[128];//A new string for storage
new playerscore;
new moneymsg[20];
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");//sends the player a message
format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);//formats the message
SendClientMessageToAll(COLOR_GREEN, gString);//sends everyone message saying player completed mission
MissionStatus[playerid] = 0;//sets the mission status of the player to '0'
playerscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, playerscore+1);
GivePlayerMoney(playerid, iPay[playerid]);
format(moneymsg, sizeof(moneymsg), "~y~+%d~g~$", iPay[playerid]);
GameTextForPlayer(playerid, moneymsg, 5000, 1);
}
PHP код:
forward unloading(playerid);
Loading timer:
PHP код:
forward loading(playerid);
public loading(playerid)
{
TogglePlayerControllable(playerid, 1);
SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);//creates the new checkpoint from the saved positions we made earlier
SendClientMessage(playerid, COLOR_ORANGE, "Loaded. Please head to the second checkpoint!");//sends message
MissionStatus[playerid] = 2;//sets the players mission status
return 1;
}
PHP код:
stock CheckpointEntered(playerid)
{
new vID = GetPlayerVehicleID(playerid);//Explained earlier
if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, COLOR_RED, "You need a trailer to unload!");//This line checks wether the player has a trailer attached to their truck.
if(MissionStatus[playerid] == 1)//checks the players mission status
{
GameTextForPlayer(playerid, "~g~loading...", 5000, 1);
TogglePlayerControllable(playerid, false);
DisablePlayerCheckpoint(playerid);
SetTimerEx("loading",5000,false,"i",playerid);
}
else if(MissionStatus[playerid] == 2)//checks the mission status of the player
{
GameTextForPlayer(playerid, "~g~unloading...", 4000, 1);
DisablePlayerCheckpoint(playerid);
SetTimerEx("unloading",6000,false,"i",playerid);
TogglePlayerControllable(playerid, false);
}
return 1;
}