13.12.2010, 04:23
(
Последний раз редактировалось VirSpectorX; 13.12.2010 в 08:54.
)
Or the other way, is using SetPVarInt. That's the easiest way.
So, it's gonna be like this
So, you'll need to add the line below in OnPlayerDisconnect part.
Good luck!
So, it's gonna be like this
pawn Код:
if(!strcmp("/work", cmdtext, true))
{
new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
if (pvehiclemodel == 403 || pvehiclemodel == 514 || pvehiclemodel == 515) {
new string[100];
new rand = random(sizeof(TruckMissionRandom));
if(GetPVarInt(playerid, "work") == 1)
{
return SendClientMessage(playerid, 0x00FF00FF, "You are already working");
}
CreatePlayerMission(playerid, TruckMissionRandom[rand][UseTrailerCheck], TruckMissionRandom[rand][MissionPay], TruckMissionRandom[rand][loadx],TruckMissionRandom[rand][loady], TruckMissionRandom[rand][loadz], TruckMissionRandom[rand][unloadx],TruckMissionRandom[rand][unloady], TruckMissionRandom[rand][unloadz]);
SetPVarInt(playerid, "work", 1);
format(string, sizeof(string), "%s", TruckMissionRandom[rand][MissionName]);
SendClientMessage(playerid, 0x00FF00FF, string);
MissionArrayID[playerid] = rand;
TextDrawHideForPlayer(playerid, mission[playerid]);
TextDrawShowForPlayer ( playerid, mission [ playerid ] );
TextDrawSetString(mission [ playerid ],string);
}
else
{
}
return 1;
}
if(!strcmp("/stopwork", cmdtext, true))
{
if(IsPlayerConnected(playerid))
{
if(GetPVarInt(playerid, "work") == 0)
{
return SendClientMessage(playerid, 0x00FF00FF, "You are not working");
}
CancelPlayersCurrentMission(playerid);
SetPVarInt(playerid, "work", 0);
new string[100];
format(string, sizeof(string),"To start a mission type /work");
TextDrawShowForPlayer ( playerid, mission [ playerid ] );
TextDrawSetString(mission [ playerid ],string);
}
return 1;
}
pawn Код:
SetPVarInt(playerid, "work", 0);
Quote:
Quantum is right. I didn't see that OnPlayerDisconnect stuff. Sorry! |