medics - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: medics (
/showthread.php?tid=271328)
[Solved ty]medics -
muhib777 - 23.07.2011
Код:
if (strcmp("/medkit", cmdtext, true, 10) == 0)
if(GetPlayerTeam(playerid) == TEAM_RIFAMEDIC)
{
SendClientMessage(playerid, 0xFFAE1CFF, "You have healed yourself");
SetPlayerHealth(playerid, 100);
}
else
{
SendClientMessage(playerid, 0xFFAE1CFF, "You are not a medic");
}
How do I make it so once the person has used this cmd they will have to wait another 2 minutes to be able to use it sorry I have no clue
Re: medics -
Cro_Haxor - 24.07.2011
Just Make Command With Timer
On The Top Of Script put this
Код:
new Timer[MAX_PLAYERS];
Put this on public OnPlayerCommandText(playerid, cmdtext[])
Код:
if (strcmp("/medkit", cmdtext, true, 10) == 0)
if(GetPlayerTeam(playerid) == TEAM_RIFAMEDIC)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(Timer[playerid] == 1) return SendClientMessage(playerid, -1, "You need to wait 2 minutes to heal yourself agian!");
SendClientMessage(playerid, 0xFFAE1CFF, "You have healed yourself");
SetPlayerHealth(playerid, 100);
Timer[playerid] = 1;
SetTimerEx(playerid, 120000, false, "%d", playerid);
}
else
{
SendClientMessage(playerid, 0xFFAE1CFF, "You are not a medic");
}
And On the end of script:
Код:
forward medkit(playerid);
public medkit(playerid)
{
Timer[playerid] = 0;
}
I think it works..
Re: medics -
muhib777 - 24.07.2011
bump does not work
Re: medics -
MoroDan - 24.07.2011
PHP код:
// Top of script
new bool:MedKitTimer[MAX_PLAYERS char] = {false, ...};
// OnPlayerConnect
MedKitTimer {playerid} = false;
if (!strcmp("/medkit", cmdtext, true))
{
if(IsPlayerConnected(playerid))
{
if(MedKitTimer {playerid}) return SendClientMessage(playerid, -1, "You have to wait 2 minutes to use again this cmd !");
if(GetPlayerTeam(playerid) == TEAM_RIFAMEDIC)
{
SetTimerEx("ResetMedKitTimer", 2 * 60 * 1000, false, "d", playerid);
SendClientMessage(playerid, 0xFFAE1CFF, "You have healed yourself");
SetPlayerHealth(playerid, 100);
MedKitTimer {playerid} = true;
}
else return SendClientMessage(playerid, 0xFFAE1CFF, "You are not a medic");
}
return 1;
}
// Somewhere
forward ResetMedKitTimer(playerid); public ResetMedKitTimer(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(MedKitTimer {playerid})
MedKitTimer {playerid} = !MedKitTimer {playerid};
// SendClientMessage(playerid, -1, "You are able to use again /medkit !");
return 1;
}
Re: medics -
MadeMan - 24.07.2011
pawn Код:
if (strcmp("/medkit", cmdtext, true) == 0)
{
if(GetPlayerTeam(playerid) != TEAM_RIFAMEDIC) return SendClientMessage(playerid, 0xFFAE1CFF, "You are not a medic");
if(GetTickCount() - GetPVarInt(playerid, "MedKitUsed") < 120000) return SendClientMessage(playerid, 0xFFAE1CFF, "You must wait 2 minutes");
SendClientMessage(playerid, 0xFFAE1CFF, "You have healed yourself");
SetPlayerHealth(playerid, 100);
SetPVarInt(playerid, "MedKitUsed", GetTickCount());
return 1;
}