THIS IS MY COMMAND I WANT THAT AFTER THE TIMER the rest of the command will be done
Код:
if(strcmp("/deliverpackages", cmd, true) == 0)
{
new string5[128], packages, price;
packages = 15;
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, " You need to login first ! ");
if(PlayerInfo[playerid][pJob] != JOB_TRUCKER) return SendClientMessage(playerid, COLOR_GREY, "You are not a Trucker.");
//if(!IsPlayerInAnyVehicle(playerid) || !IsTruckerVehicle(GetPlayerVehicleID(playerid)) || !IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Trucker vehicle or you have no trailer attached.");
if(!PlayerInfo[playerid][pTPackages]) return SendClientMessage(playerid, COLOR_GREY, "You have no packages on you.");
if(PlayerInfo[playerid][pDeliverTruck] != GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, COLOR_GREY, "This is not the vehicle that your packages were loaded to.");
if(!IsPlayerInRangeOfPoint(playerid, 5, 1727.3557,2309.9985,10.8203)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a packages dropoff.");
if(PlayerInfo[playerid][pTPackages] == 1) {price = packages*50;}
else if(PlayerInfo[playerid][pTPackages] == 2) {price = packages*80;}
//GiveZaiatMoney(playerid, price);
PlayerInfo[playerid][pPayCheck] += price;
waittimer[playerid] = SetTimerEx("CountTime",1000,1,"i",playerid);
waittime = 25;
TextDrawSetString(WaitDraw[playerid], "25");
TextDrawShowForPlayer(playerid, WaitDraw[playerid]);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_LIGHTRED, "Delivering packages...");
DisablePlayerCheckpoint(playerid);
format(string, sizeof(string), "~w~Added to your paycheck~n~~g~$%d",price);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerInfo[playerid][pDeliverTruck] = -1;
TruckPackages[GetPlayerVehicleID(playerid)] = -1;
format(string5, sizeof(string5), "* %s has delivered %d products packages to the dropoff.", RPN(playerid), PlayerInfo[playerid][pTPackages]*5);
SendNearbyMessage(playerid, 15, string5, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
format(string5, sizeof(string5), "* You have delivered {FF6347}%d products{33CCFF} packages for {FF6347}$%d{33CCFF}", PlayerInfo[playerid][pTPackages]*5, price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string5);
PlayerInfo[playerid][pTPackages] = 0;
return 1;
}
Код:
forward CountTime(playerid);
public CountTime(playerid)
{
new string[256];
waittime--;
format(string, sizeof(string), "~b~%d", waittime);
PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
TextDrawSetString(WaitDraw[playerid], string);
if (waittime == 0)
{
KillTimer(waittimer[playerid]);
TextDrawSetString(WaitDraw[playerid], "");
TextDrawHideForPlayer(playerid,WaitDraw[playerid]);
}
return 1;
}
as your command processor, it has a built in function which will return other commands so in your timer you will be able to simply return the command at the end of the timer using: