Few questions ((Rp Gm))
#1

Hey guys, im back for some more help, haha.

1.) How could i make if someone has under 25hp he goes into /crack and maybe if possible a message gets sent to paramedic faction saying Injured man found near persons location, I know its some type of timer, if possible could someone show me the full code? if now give me parts and a small tut?


2.) How could i add "Display" cars in my gm. atm we have /buyvehicle at a checkpoint but i want to make say 10 display cars, you go in car do /v buy and car spawns at my given coords which you own. I saw this on ravens 2.8, if no one can help i guess i could try ripping and giving credits.


Side note: This is for rp server, thanks in advance for help
Reply
#2

1) getplayerhealth, then OnePlayAnimation or LoopingAnimation..., sendclientmessage

2)ifisplayerinvehicle, getplayermoney, setplayerpos,setvehiclepos

use wiki if you don't know how to use that
Reply
#3

Ehm...thanks for giving me the mini codes i need, i code use more info for question 1 is possible
Reply
#4

if you want the script, just ask it! lol like this it will work:
Код:
//under defines
new gPlayerUsingLoopingAnim[MAX_PLAYERS];

LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    gPlayerUsingLoopingAnim[playerid] = 1;
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
//
public onplayerupdate(playerid); // i'd recommand to use a timer for this, go see my tutorial on speedo with timer, it will get you started with timers 
{
   new Float:health;

    GetPlayerHealth(playerid,health);
    if (health < 25.0)
    {
    new string[256];
    LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // nice anim for this, but change it if you like (sweet_injured is nice too).
    format(string, sizeof(string), "~p~ You need Help!"); // color is purple
    GameTextForPlayer(playerid, string, 3000, 5); // 3000 is 3 second and 5 is the writiing style
    TogglePlayerControllable(playerid, false);

    return 1;
    }

	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(gPlayerUsingLoopingAnim[playerid]) {
		gPlayerUsingLoopingAnim[playerid] = 0; // reset player, if killed while needing help
                             TogglePlayerControllable(playerid, True); //makes the player controllable , if killed during anim
	}

 	return 1;
}
i let you manage how to make the medics know the guy is hurt, do some of the work! haha
Reply
#5

Thanks a ton, yes i will do the medics part, you just saved me hours .
Reply
#6

edit : C:\Documents and Settings\nnn\Desktop\GFRP\gamemodes\penls.pwn(2694 ) : error 017: undefined symbol "True"

fixed, changed capital T to lowercase t testing now

edit: It works as i planned, only problem some people say it doesnt make them into crack, but on other peoples screen they are. also when they get healed they dont get unfrozen and standing up, im guessing this is where timer comes in?
Reply
#7

pawn Код:
//under defines
new gPlayerUsingLoopingAnim[MAX_PLAYERS];

LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    gPlayerUsingLoopingAnim[playerid] = 1;
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
//
public onplayerupdate(playerid); // i'd recommand to use a timer for this, go see my tutorial on speedo with timer, it will get you started with timers
{
   new Float:health;

    GetPlayerHealth(playerid,health);
    if (health < 25.0)
    {
    new string[256];
    LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // nice anim for this, but change it if you like (sweet_injured is nice too).
    format(string, sizeof(string), "~p~ You need Help!"); // color is purple
    GameTextForPlayer(playerid, string, 3000, 5); // 3000 is 3 second and 5 is the writiing style
    TogglePlayerControllable(playerid, false);
    LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); //

    return 1;
    }

    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(gPlayerUsingLoopingAnim[playerid]) {
        gPlayerUsingLoopingAnim[playerid] = 0; // reset player, if killed while needing help
                             TogglePlayerControllable(playerid, True); //makes the player controllable , if killed during anim
    }

    return 1;
}
Reply
#8

Thanks i will try the above
Reply
#9

On a more realistic way (recommended for rp servers)

pawn Код:
// On top of your screen
new injuretimer, Injured[MAX_PLAYERS];

forward InjuredT(playerid);

public OnPlayerUpdate(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    if (health < 25.0)
    {
        new string[50];
        LoopingAnim(playerid, "SWEET", "Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0);
        format(string, sizeof(string), "~r~You need help!");
        GameTextForPlayer(playerid, string, 3000, 5);
        TogglePlayerControllable(playerid, false); // disallows him to metagame ^^
        SetCameraBehindPlayer(playerid); // turns the camera back for a better view
        injuretimer = SetTimerEx("InjuredT", 3000, true, "d", playerid); // starts a timer, every 3 seconds you lose 1 hp
        Injured[playerid] = 1;
    }
    else KillTimer(injuretimer), Injured[playerid] = 0; // this is for safety so it won't bug
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(gPlayerUsingLoopingAnim[playerid])
    {
        gPlayerUsingLoopingAnim[playerid] = 0;
        TogglePlayerControllable(playerid, true);
    }
    if(Injured[playerid] == 1)
    {
        KillTimer(injuretimer);
        Injured[playerid] = 0;
    }
    return 1;
}

public InjuredT(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    SetPlayerHealth(playerid, health-1);
    return 1;
}
The things that the medics are supposed to do, do you need to add
Reply
#10

Quote:

edit: It works as i planned, only problem some people say it doesnt make them into crack, but on other peoples screen they are. also when they get healed they dont get unfrozen and standing up, im guessing this is where timer comes in?

1) i think you have to pre load the crack library :
to do so, add PreloadAnimLib(playerid,"CRACK"); to your onplayerspawn callback

2)if they dont get unfrozen, it's because in your heal command, you must do like, toggleplayercontrollable(playerid, True); //in this case, playerid is the wounded player

Hey wups, what did you changed in my script you just put twice LoopingAnim crack
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)