A CMD that bugs my server.
#1

pawn Код:
CMD:heal(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsAMedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be a Medic to use this command.");
    SetPlayerHealth(playerid, 100);
    SetPlayerMoney(playerid, -45);
    SendClientMessage(playerid, COLOR_GREY, "You have healed %s for 45$.");
    return 1;
}
Well i made this command for my new LSFMD faction,but after i type it,my server is restarting.Im using zGaming edit.Any ideas/
Reply
#2

Shouldn't be GivePlayerMoney( playerid, -45 ); instead of SetPlayerMoney ?
Reply
#3

Quote:
Originally Posted by [V]PawnFox
Посмотреть сообщение
Shouldn't be GivePlayerMoney( playerid, -45 ); instead of SetPlayerMoney ?
It's still restarting.
Reply
#4

so.. let me just check, you are sure of this command?
pawn Код:
CMD:heal(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsAMedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be a Medic to use this command.");
//until here i get it, but this is strange
    SetPlayerHealth(playerid, 100);//you set your own health?
    SetPlayerMoney(playerid, -45);//you take away money from yourself?
    SendClientMessage(playerid, COLOR_GREY, "You have healed %s for 45$.");//%s in a sendclientmessage? this won't work as you want..
    return 1;
}
Use this command:
pawn Код:
CMD:heal(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsAMedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be a Medic to use this command.");
    new id;
    if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /heal <playerid>");
    if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
   
    SetPlayerHealth(id, 100.0);
    SendClientMessage(id, 0x00FF00AA, "You have been healed by a Medic!");
    SendClientMessage(playerid, 0x00FF00AA, "You have healed the player.");
   
    return 1;
}
use this one, and tell me what happens
Reply
#5

If its a zGaming edit, it should be like this:

pawn Код:
CMD:heal(playerid, params[])
{
        new playerb, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
        if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /heal [playerid]");
    if(!IsAMedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be a Medic to use this command.");
    SetPlayerHealth(playerb, 100);
    SetPlayerMoney(playerb, -45);
        format(string, sizeof(string), "You have healed %s for 45$.", RPN(playerb));
    SendClientMessage(playerid, COLOR_GREY, string);
    return 1;
}
Reply
#6

The problem now is that /heal takes 45$ but refunds them back again..
Reply
#7

Fix:

pawn Код:
CMD:heal(playerid, params[])
{
        new playerb, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
        if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /heal [playerid]");
    if(!IsAMedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be a Medic to use this command.");
    SetPlayerHealth(playerb, 100);
    GiveZaiatMoney(playerb, -45);
        format(string, sizeof(string), "You have healed %s for 45$.", RPN(playerb));
    SendClientMessage(playerid, COLOR_GREY, string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)