02.08.2014, 04:58
(I'm a Beginner, so I might say stupid things, I started learning pawno 1 day ago)
I made a /whereismech command that creates a checkpoint at the mechanic place, I also added a boolean(false) that gets a (true) after using the checkpoint command, so the player will need to /deletecheckpoint to have another
Everything works fine, that's what I thought in the beginning. It does actually but only if there's 1 player in the server, when there are 2 players if one of them uses /whereismech , a checkpoint will appear, and the boolean will change to (true) so he won't be able to /whereismech again before using /deletecheckpoint or touching the checkpoint, the second player also can't use /whereismech since the boolean contains true already , because the first player used the /whereismech command: I wish you get it .
Code
Any Idea? How Can I fix it so the boolean doesn't change for everyone, only for the player who has used the command
I made a /whereismech command that creates a checkpoint at the mechanic place, I also added a boolean(false) that gets a (true) after using the checkpoint command, so the player will need to /deletecheckpoint to have another
Everything works fine, that's what I thought in the beginning. It does actually but only if there's 1 player in the server, when there are 2 players if one of them uses /whereismech , a checkpoint will appear, and the boolean will change to (true) so he won't be able to /whereismech again before using /deletecheckpoint or touching the checkpoint, the second player also can't use /whereismech since the boolean contains true already , because the first player used the /whereismech command: I wish you get it .
Code
pawn Код:
new bool:Bo=false;
pawn Код:
if (strcmp(cmdtext, "/whereismech", true) == 0)
{
if (Bo == true) return SendClientMessage(playerid, 0xFF0000AA, "You already have an active Checkpoint, please use /deletecheckpoint to have another one");
else
{
if (!IsPlayerInRangeOfPoint(playerid, 5, 1607.2327, -1841.8683, 13.5116))
{
SetPlayerCheckpoint(playerid, 1607.2327, -1841.8683, 13.5116, 3);
SendClientMessage (playerid, 0xFF0000AA, "Go to the checkpoint and /repair there");
Bo=true;
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are already in the mechanic place, use /repair, this will cost you 5000$");
return 1;
}
}
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
Bo=false;
return 1;
}