Code which can let choose whatever integer player wants to insert into command
#5

So now i edited my code, but there's some errors and some uncertainty.So I have code under OnPlayerCommandText and OnDialogResponse callbacks.Codes:
pawn Код:
if(strcmp(cmd, "/penalty", true) == 0)
    {
        new tmp[256];
        new money[128];
        tmp = strtok(cmdtext, idx);
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /penalty [Player_nick] [amount of penalty]");
        if(strlen(money) == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /penalty [Player_nick] [amount of penalty]");
        if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "This player is not online!");
        new Float:x,Float:y,Float:z;
        if(!IsPlayerInRangeOfPoint(playerid, 7.0, x, y, z))
        {
            SendClientMessage(playerid, 0xAFAFAFAA, "He's running!!!");
        }
        else
        {
            new policeman;
            new string[128];
            GetPlayerName(playerid, policeman, sizeof(policeman));
            format(string, sizeof(string), "Yo was stopped by %s.He wants that you pay %d $ for the penalty, if you don't pay, you will be jailed!", policeman, money);
            ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "penalty", string, "agree", "disagree");
        }
    }
And second:
pawn Код:
{
    if(dialogid == 0)
    if(!response)
    {
        TogglePlayerControllable(playerid, 0);
        return 1;
    }
    else
    {
        SetPlayerMoney(playerid, [b]here[/b]);
        return 1;
    }
    return 0;
}
Questions

1.Ok so how you see, i'm using strtok to search what is writed after the command (/command HERE), but how exactly I can set what player needs to write here, that command can work?
2.How to deal with these errors:
Код:
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(230) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(230) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(490) : error 017: undefined symbol "pinigai"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
3.And how to remove money from the player, who was punished in this command: SetPlayerMoney(playerid, here);?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)