Hallo Community,
Ich habe ein Problem mit meinen /usedrugs Command, er funktionier aber ich will gerne das man nach /usedrugs 15 Sekunden warten muss bis man wieder Drogen nehmen Kann.
Mein Code sieht so aus.
Oben
new PlayerUseDrugs[MAX_PLAYERS];
forward PlayerUnUseDrugs(playerid);
Der CMD
if(strcmp("/usedrugs", cmd, true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pDrugs] >= 2)
{
new Float:Health;
GetPlayerName(playerid,sendername,sizeof(sendername));
GetPlayerHealth(playerid, Health);
PlayerStoned[playerid] += 1;
if(PlayerStoned[playerid] >= 30)
{
PlayerStonedTime[playerid] = 180;
}
if(PlayerStonedTime[playerid] > 0)
{
GameTextForPlayer(playerid, "~w~Du bist~n~~p~bekifft", 4000, 1);
SetPlayerDrunkLevel(playerid,GetPlayerDrunkLevel(playerid) +3000);
}
if(PlayerInfo[playerid][pDrugPerk] > 0)
{
new hp = 5 * PlayerInfo[playerid][pDrugPerk];
SetPlayerHealth(playerid, Health + hp);
}
else
{
SetPlayerHealth(playerid, Health + 4);
}
if(PlayerUseDrugs[playerid]) return 1; // 15 Sekunden nicht um.
SetTimerEx("PlayerUnUseDrugs", 15000, 0, "i", playerid);
PlayerInfo[playerid][pDrugs] -= 2;
OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
format(string, sizeof(string), "* %s pfeift sich 2 Gramm Drogen rein.", sendername);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
format(string,sizeof(string),"* %s nutzt usedrugs", sendername);
EnterToLog("usedrugs",string);
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du hast keine Drogen !");
}
}
return 1;
}
der Public
public PlayerUnUseDrugs(playerid)
{
PlayerUseDrugs[playerid] = 0;
}
Danke schonmal für eure Hilfe