Death Timer At Hospital
#1

When you die you should wait until your health recharges at the hospoital. (Done using a timer), But it just seems to spawn me after 1 second.

pawn Код:
public Death(playerid)
{
    new Float:H = GetPlayerHealth(playerid,H);
   
    if (H < 100)
    {
    SetPlayerHealth(playerid,(H+5));
    return 1;
   
    }else{
   
  SetPlayerPos(playerid,-314.1351,1056.9514,19.7422);
  SetPlayerFacingAngle(playerid,357.2336);
  SetCameraBehindPlayer(playerid);
  GameTextForPlayer(playerid, "~w~You Have Been ~b~Healed!", 5000, 3);
    }
    return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new name[24], string[64];
    GetPlayerName(playerid, name, 24);
    format(string, sizeof(string), "%s Has Died!", name);
    SendClientMessageToAll(COLOUR_LIGHTRED, string);
    Drugs[playerid] = 0;
//------------------------------------------------------------------------------
    new HospBill;
    new dstr[128];
    HospBill = (random(2000))+1000;
    GivePlayerMoney(playerid,-HospBill);
    format(dstr, sizeof(dstr), "~w~Hospital Bill: ~r~$%s~n~~n~~r~Being Healed~n~~n~~n~~b~Please Wait", HospBill);
    GameTextForPlayer(playerid, dstr, 15000, 3);
    SetPlayerCameraPos(playerid, -285.2971, 1054.9896, 27.5900);
    SetPlayerCameraLookAt(playerid, -294.2486, 1050.8154, 26.0256);
    SetPlayerPos(playerid,-321.853,1042.690,19.401);
    TogglePlayerControllable(playerid,0);
    SetTimer("Death",1000,true);
    return 1;
}
Reply
#2

I really need help with this Thanks.
Reply
#3

https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#4

Thanks for the reply but that wiki page is very hard to understand and I dont get what SetTimerEx is even doing. Can someone please help me with the SetTimerEx.
Reply
#5

SetTimerEx is for a specific player, your SetTimer will only work for playerid 0.
Reply
#6

SetTimerEx is to pass parameters to a timed function
SetTimerEx(Function, Time, Repeating, FormatOfWhatToSend, WhatToSend)
playerid is an integer (number) so for FormatOfWhatToSend you would put i or d, Then in what to send you would put playerid
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)