String is messed up?
#1

Okay so everything works, but it does not show the players name instead it shows like i_cmd or some other crazy stuff.

Код:
COMMAND:rob(playerid, params[])
{
    new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
    new Str[128];
    new deadid;
    if(sscanf(params, "u", deadid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /rob [ID].");
    if(PlayerDied[deadid] == 1) {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(deadid, X, Y, Z);
        if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z)) {
            if(!IsPlayerConnected(deadid)) return SendClientMessage(playerid, COLOR_RED, "That player is not connected!");
            if (playerid == deadid) return SendClientMessage(playerid, COLOR_RED,"You can't rob yourself!");
            GivePlayerMoney(playerid, 500);
            GivePlayerMoney(deadid, -500);
            GetPlayerName(PID, pName, sizeof(pName));
            GetPlayerName(playerid, Sender, sizeof(Sender));
            format(Str, sizeof(Str), "You were robbed by %s.", playerid);
            SendClientMessage(deadid, COLOR_RED, Str);
            format(Str, sizeof(Str), "You searched %s pockets and found 500$.", deadid);
            SendClientMessage(playerid, COLOR_GREEN, Str);
            format(Str, sizeof(Str), "%s takes %s wallet.", playerid, deadid);
  		  	ProxDetector(15.0, playerid, Str, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else {
            SCM(playerid, COLOR_RED, "You're not close to anybody that's dying.");
        }
    }
    return 1;
}
Reply
#2

pawn Код:
GetPlayerName(deadid, pName, sizeof(pName));
            GetPlayerName(playerid, Sender, sizeof(Sender));
            format(Str, sizeof(Str), "You were robbed by %s.", Sender);
            SendClientMessage(deadid, COLOR_RED, Str);
            format(Str, sizeof(Str), "You searched %s pockets and found 500$.", pName);
            SendClientMessage(playerid, COLOR_GREEN, Str);
            format(Str, sizeof(Str), "%s takes %s wallet.", Sender, pName);
Reply
#3

Quote:
Originally Posted by antonio112
Посмотреть сообщение
pawn Код:
GetPlayerName(PID, pName, sizeof(pName));
            GetPlayerName(playerid, Sender, sizeof(Sender));
            format(Str, sizeof(Str), "You were robbed by %s.", Sender);
            SendClientMessage(deadid, COLOR_RED, Str);
            format(Str, sizeof(Str), "You searched %s pockets and found 500$.", pName);
            SendClientMessage(playerid, COLOR_GREEN, Str);
            format(Str, sizeof(Str), "%s takes %s wallet.", Sender, pName);
I think i'm tired, thanks btw!
Reply
#4

Also PID isn't defined as anything in your command. So GetPlayerName won't do anything on it. Maybe you should add:
pawn Код:
PID = playerid;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)