help a little
#1

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
Reply
#2

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

Reply
#3

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.
Reply
#4

Код:
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.
Reply
#5

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
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)