help a little - 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: help a little (
/showthread.php?tid=610297)
help a little -
Owen007 - 22.06.2016
public
OnPlayerEnterCheckpoint
(playerid)
{
if(gTeam[playerid] ==
TEAM_HUMAN) {
GameTextForPlayer
(playerid,"~r~ You have
cleared the
checkpoint.",6000,4);
SendClientMessageToAll
(PURPLE,"You have been
given 5000$");
SendClientMessageToAll
(PURPLE,"You have been
given Medical Attention.");
SetPlayerScore
(playerid, GetPlayerScore
(playerid) + 1);
SetPlayerHealth
(playerid, 100);
GivePlayerMoney
(playerid,5000);
}
if(gTeam[playerid] ==
TEAM_ZOMBIE) {
GameTextForPlayer
(playerid,"~g~ Fuck those
survivors.",6000,4);
}
return 1;
}
I m having bug that when i enter cp player gets money and health but when he comes out of cp and again get inside the same cp he will again get money and health. plz tell me how can i give one player only one time money and health. p.s :- i dont want to use disableplayercheckpoint command
Re: help a little -
luke49 - 22.06.2016
PHP код:
//set a time to variable that you want
variable += gettime() + 86400; //1 day
PHP код:
//check if time is up for that variable
if (variable <= gettime()) {
//1 day ended, set what you need
}
else {
//still waiting for the end of 1 day
}
Re: help a little -
Owen007 - 22.06.2016
Quote:
Originally Posted by luke49
PHP код:
//set a time to variable that you want
variable += gettime() + 86400; //1 day
PHP код:
//check if time is up for that variable
if (variable <= gettime()) {
//1 day ended, set what you need
}
else {
//still waiting for the end of 1 day
}
|
still understood nothing. just tell me how can i give one player only one time money and health.
Re: help a little -
MBilal - 22.06.2016
Код:
public
OnPlayerEnterCheckpoint
(playerid)
{
if(gTeam[playerid] ==
TEAM_HUMAN) {
GameTextForPlayer
(playerid,"~r~ You have
cleared the
checkpoint.",6000,4);
SendClientMessageToAll
(PURPLE,"You have been
given 5000$");
SendClientMessageToAll
(PURPLE,"You have been
given Medical Attention.");
SetPlayerScore
(playerid, GetPlayerScore
(playerid) + 1);
SetPlayerHealth
(playerid, 100);
GivePlayerMoney
(playerid,5000);
DisablePlayerCheckpoint(playerid);
}
if(gTeam[playerid] ==
TEAM_ZOMBIE) {
GameTextForPlayer
(playerid,"~g~ Fuck those
survivors.",6000,4);
DisablePlayerCheckpoint(playerid);
}
return 1;
}
Disable player cp when he enter and got money and health.
Re: help a little -
Owen007 - 22.06.2016
Quote:
Originally Posted by MBilal
Код:
public
OnPlayerEnterCheckpoint
(playerid)
{
if(gTeam[playerid] ==
TEAM_HUMAN) {
GameTextForPlayer
(playerid,"~r~ You have
cleared the
checkpoint.",6000,4);
SendClientMessageToAll
(PURPLE,"You have been
given 5000$");
SendClientMessageToAll
(PURPLE,"You have been
given Medical Attention.");
SetPlayerScore
(playerid, GetPlayerScore
(playerid) + 1);
SetPlayerHealth
(playerid, 100);
GivePlayerMoney
(playerid,5000);
DisablePlayerCheckpoint(playerid);
}
if(gTeam[playerid] ==
TEAM_ZOMBIE) {
GameTextForPlayer
(playerid,"~g~ Fuck those
survivors.",6000,4);
DisablePlayerCheckpoint(playerid);
}
return 1;
}
Disable player cp when he enter and got money and health.
|
i dont want to disable cp until the next cp comes bro
Re: help a little -
luke49 - 22.06.2016
Quote:
Originally Posted by Owen007
still understood nothing. just tell me how can i give one player only one time money and health.
|
Option 1:
PHP код:
new Checkpoint1 [ MAX_PLAYERS ];
Set it as 1 (or whatever number you choose) when a player enters a checkpoint, later check if it is 1 (or whatever number you chose) and inform a player, that he already picked it up, else - give him health, armour and etc.
Option 2 (better choice (code that I gave you some posts ago)):
Set for some variable a time. Later check if time is up. If it is, give him health, amour and etc., else - inform a player, that he already picked it up.