How to fix this...
#1

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//   printf("OnPlayerDeath: playerid: %d, killerid: %d, reason: %s", playerid, killerid, reason); //debug
    ClearGuns(playerid);
    SetPlayerColor(playerid, TCOLOR_HOSPITAL);
    GameTextForPlayer(playerid,"~w~Wasted",4000,2);
    SetPlayerVirtualWorld(playerid, 0);
    PlayerInfo[playerid][pOnDuty] = 0;
    PlayerInfo[playerid][pBombs] = 0;
    PlayerInfo[playerid][pScope] = 0;
    PlayerInfo[playerid][pLocal] = 999;
    PlayerInfo[playerid][pVirtualWorld] = 0;
    PlayerInfo[killerid][pKills] += 1;
    CapturingTimer[playerid] = 0;
    STDPlayer[playerid] = 0;
    IsAtEvent[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new killa[MAX_PLAYER_NAME];
    new deathreason[25];
    new string[128];
    new caller = Mobile[playerid];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(killerid, killa, sizeof(killa));
    if(RobStatus[Setup] == 1 && RobStatus[BeingRobbed] == 0 && RobStatus[RobberID1] == playerid)
    {
        RobStatus[Setup] = 0;
        SendClientMessage(RobStatus[RobberID1], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID2], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID3], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID4], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID5], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        RobStatus[RobberID1] = 255;
        RobStatus[RobberID2] = 255;
        RobStatus[RobberID3] = 255;
        RobStatus[RobberID4] = 255;
        RobStatus[RobberID5] = 255;
    }
    if(PlayerInfo[playerid][Robbing] == 1)
    {
        if(RobStatus[RobberID1] == playerid)
        {
            RobStatus[RobberID1] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID2] == playerid)
        {
            RobStatus[RobberID2] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID3] == playerid)
        {
            RobStatus[RobberID3] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID4] == playerid)
        {
            RobStatus[RobberID4] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID5] == playerid)
        {
            RobStatus[RobberID5] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        format(string,sizeof(string),"** You've died and failed to get your money of $%d",PlayerInfo[playerid][CashLoaded]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        PlayerInfo[playerid][CashLoaded] = 0;
        PlayerInfo[playerid][Robbing] = 0;
        DisablePlayerCheckpoint(playerid);
    }
    if(gPlayerUsingApplyAnim[playerid])
    {
        gPlayerUsingApplyAnim[playerid] = 0;
        TextDrawHideForPlayer(playerid,txtAnimhelper);
    }
    if (GetPlayerState(playerid) == 1)
    {
        return 1;
    }
    TextDrawHideForPlayer(playerid, Textdraw2[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw3[playerid]);
    if(GetPlayerState(killerid) == 2)
    {
        new vehicleid = GetPlayerVehicleID(killerid);
        if(IsAHelicopter(vehicleid))
        {
            format(string, sizeof(string), "AdmWarning: %s has killed %s, Bladekilling.",killa,name);
            UpdateWarnings(string);
        }
        if(GetPlayerWeapon(killerid) == 29)
        {
            format(string, sizeof(string), "AdmWarning: %s has killed %s, Drivershooting.",killa,name);
            UpdateWarnings(string);
        }
    }
    if(killerid != INVALID_PLAYER_ID)
    {
        if(reason == 0) { deathreason = "Melee"; }
        else if(reason == 36 || reason == 35 || reason == 40 || reason == 16) { deathreason = "Explosion"; }
        else if(reason == 18 || reason == 37) { deathreason = "Fire"; }
        else if(reason == 51) { deathreason = "Explosion"; }
        else if(reason == 50) { deathreason = "Heli-Kill"; }
        else { GetWeaponName(reason, deathreason, sizeof(deathreason)); }
        format(string, sizeof(string), "%s(%d) has been killed by %s(%d) using %s",name,playerid,killa,killerid,deathreason);
        DeathMessages(playerid,COLOR_YELLOW2,string);
    }
I want to fix something..

I got a /acceptdeath system, but in my server script when you die you will spawn at the Hospital Automatically, that's what I want to edit..
To make it as acceptdeath system, that you will spawn at Hospital if you do /acceptdeath not if you got killed by someone, it will send you automatically

2nd Question:
In my server script when you pay something like Pay and Spray or Tolls they will took $100 (Pay n' spray), $50 (Toll) but that's bugged because you will get back what you paid.. and I want to make it that if you paid $100 then you will lose $100 from your Cash Bar..
Reply
#2

Hmm, this is for the /acceptdeath system. Not sure about the Pay n Spray problem you have.

Not 100% sure if it will work, try it:

pawn Код:
// top of script

new OfferedDeath[MAX_PLAYERS];

// onplayerspawn

if(OfferedDeath[playerid] == 1)
{
    return SendClientMessage(playerid,-1,"You Have Been Offered To Be Taken To The Hospital. Type /acceptdeath To Accept This.");
}

// /acceptdeath command

if(OfferedDeath[playerid] == 1)
{
    SendClientMessage(playerid,-1,"You Are Now At The Hospital. Please Wait For Further Assistance ...");
    // hospital stuff
    // hospital stuff etc ...
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
//   printf("OnPlayerDeath: playerid: %d, killerid: %d, reason: %s", playerid, killerid, reason); //debug

    OfferedDeath[playerid] = 1; // when they die, they will be offered /acceptdeath on spawn

    ClearGuns(playerid);
    SetPlayerColor(playerid, TCOLOR_HOSPITAL);
    GameTextForPlayer(playerid,"~w~Wasted",4000,2);
    SetPlayerVirtualWorld(playerid, 0);
    PlayerInfo[playerid][pOnDuty] = 0;
    PlayerInfo[playerid][pBombs] = 0;
    PlayerInfo[playerid][pScope] = 0;
    PlayerInfo[playerid][pLocal] = 999;
    PlayerInfo[playerid][pVirtualWorld] = 0;
    PlayerInfo[killerid][pKills] += 1;
    CapturingTimer[playerid] = 0;
    STDPlayer[playerid] = 0;
    IsAtEvent[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new killa[MAX_PLAYER_NAME];
    new deathreason[25];
    new string[128];
    new caller = Mobile[playerid];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(killerid, killa, sizeof(killa));
    if(RobStatus[Setup] == 1 && RobStatus[BeingRobbed] == 0 && RobStatus[RobberID1] == playerid)
    {
        RobStatus[Setup] = 0;
        SendClientMessage(RobStatus[RobberID1], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID2], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID3], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID4], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        SendClientMessage(RobStatus[RobberID5], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
        RobStatus[RobberID1] = 255;
        RobStatus[RobberID2] = 255;
        RobStatus[RobberID3] = 255;
        RobStatus[RobberID4] = 255;
        RobStatus[RobberID5] = 255;
    }
    if(PlayerInfo[playerid][Robbing] == 1)
    {
        if(RobStatus[RobberID1] == playerid)
        {
            RobStatus[RobberID1] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID2] == playerid)
        {
            RobStatus[RobberID2] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID3] == playerid)
        {
            RobStatus[RobberID3] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID4] == playerid)
        {
            RobStatus[RobberID4] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        if(RobStatus[RobberID5] == playerid)
        {
            RobStatus[RobberID5] = 200;
            if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
            {
                RobStatus[BeingRobbed] = 0;
                RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
                RobStatus[Setup] = 0;
                SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
                FinishRobbery();
            }
        }
        format(string,sizeof(string),"** You've died and failed to get your money of $%d",PlayerInfo[playerid][CashLoaded]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        PlayerInfo[playerid][CashLoaded] = 0;
        PlayerInfo[playerid][Robbing] = 0;
        DisablePlayerCheckpoint(playerid);
    }
    if(gPlayerUsingApplyAnim[playerid])
    {
        gPlayerUsingApplyAnim[playerid] = 0;
        TextDrawHideForPlayer(playerid,txtAnimhelper);
    }
    if (GetPlayerState(playerid) == 1)
    {
        return 1;
    }
    TextDrawHideForPlayer(playerid, Textdraw2[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw3[playerid]);
    if(GetPlayerState(killerid) == 2)
    {
        new vehicleid = GetPlayerVehicleID(killerid);
        if(IsAHelicopter(vehicleid))
        {
            format(string, sizeof(string), "AdmWarning: %s has killed %s, Bladekilling.",killa,name);
            UpdateWarnings(string);
        }
        if(GetPlayerWeapon(killerid) == 29)
        {
            format(string, sizeof(string), "AdmWarning: %s has killed %s, Drivershooting.",killa,name);
            UpdateWarnings(string);
        }
    }
    if(killerid != INVALID_PLAYER_ID)
    {
        if(reason == 0) { deathreason = "Melee"; }
        else if(reason == 36 || reason == 35 || reason == 40 || reason == 16) { deathreason = "Explosion"; }
        else if(reason == 18 || reason == 37) { deathreason = "Fire"; }
        else if(reason == 51) { deathreason = "Explosion"; }
        else if(reason == 50) { deathreason = "Heli-Kill"; }
        else { GetWeaponName(reason, deathreason, sizeof(deathreason)); }
        format(string, sizeof(string), "%s(%d) has been killed by %s(%d) using %s",name,playerid,killa,killerid,deathreason);
        DeathMessages(playerid,COLOR_YELLOW2,string);
    }
Reply
#3

pawn Код:
if(OfferedDeath[playerid] == 1)
{
    SendClientMessage(playerid,-1,"You Are Now At The Hospital. Please Wait For Further Assistance ...");
    // hospital stuff
    // hospital stuff etc ...
    return 1;
}
Do I have to place something on //hospital stuff?
Reply
#4

If you want.

I was thinking maybe you wanted to add an animation, or let them be charged or something but you don't have to add anything.
Reply
#5

pawn Код:
// /acceptdeath command

if(OfferedDeath[playerid] == 1)
{
    SendClientMessage(playerid,-1,"You Are Now At The Hospital. Please Wait For Further Assistance ...");
    // hospital stuff
    // hospital stuff etc ...
    return 1;
}
This one isn't giving me error, but where is the /acceptdeath command? ^

pawn Код:
if(strcmp(cmd,"/acceptdeath",true)==0)
{
        if(OfferedDeath[playerid] == 1)
        {
    SendClientMessage(playerid,-1,"You Are Now At The Hospital. Please Wait For Further Assistance ...");
    // hospital stuff
    // hospital stuff etc ...
    return 1;
    }
I added the /acceptdeath command, but that's giving me 26 errors in Pawno..
Reply
#6

pawn Код:
if(strcmp(cmd,"/acceptdeath",true)==0)
{
    if(OfferedDeath[playerid] == 1)
    {
        SendClientMessage(playerid,-1,"You Are Now At The Hospital. Please Wait For Further Assistance ...");
        // hospital stuff
        // hospital stuff etc ...
        return 1;
    }
}
Reply
#7

You where missing a :

pawn Код:
}
Reply
#8

Well, when someone kill me I'm apearing at the Newbie Spawn with another skin and when I do /acceptdeath it says "You are now at the Hospital" but I aint in the Hospital..

Reply
#9

You need to set the position, interior and virtual world to a hospital interior.

https://sampwiki.blast.hk/wiki/SetPlayerPos
https://sampwiki.blast.hk/wiki/SetPlayerVirtualWorld
https://sampwiki.blast.hk/wiki/SetPlayerInterior
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)