29.08.2013, 11:44
I would like to make a system where the player firstly has to type /start and afterwards he must go to a specific location and type /delivergoods but he must type /start first.
new Delivering[MAX_PLAYERS];
COMMAND:start(playerid,params[])
{
// Your code here, e.g. tell the player he has started the job
Delivering[playerid] = 1;
return 1;
}
COMMAND:delivergoods(playerid,params[])
{
if(Delivering[playerid] != 1)
{
SendClientMessage(playerid, COLOR-HERE, "You need to type /start - blablabla ;p");
return 1;
}
// he is delivering, put your code here :)
Delivering[playerid] = 0; // Set this back to 0 so he can do the job again ;)
return 1;
}
new HasStarted[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
HasStarted[playerid] = 0;
return 1;
}
CMD:start(playerid, params[])
{
HasStarted[playerid] = 1;
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You've started the delivery job.");
return 1;
}
CMD:delivergoods(playerid, params[])
{
if(HasStarted[playerid] == 1)
{
//He has started
}
else
{
//He hasn't started yet
}
return 1;
}