Is there a line to check if the player has typed the command before - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is there a line to check if the player has typed the command before (
/showthread.php?tid=460637)
Is there a line to check if the player has typed the command before -
Lynchos - 29.08.2013
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.
Re: Is there a line to check if the player has typed the command before -
lewismichaelbbc - 29.08.2013
Top of script:
pawn Код:
new Delivering[MAX_PLAYERS];
on the /start command, you can add:
pawn Код:
COMMAND:start(playerid,params[])
{
// Your code here, e.g. tell the player he has started the job
Delivering[playerid] = 1;
return 1;
}
then on the delivergoods command:
pawn Код:
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;
}
Re: Is there a line to check if the player has typed the command before -
Finn707 - 29.08.2013
pawn Код:
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;
}
Edit: Oops too late.
Re: Is there a line to check if the player has typed the command before -
Konstantinos - 29.08.2013
Suggestion: You can use boolean instead for such as things (
false/
true only).