Help please.
#1

Hey guys.
Error

pawn Код:
if (dialogid == 21)
    {
        new tmp[100],idx;
        new string[128];
        new id = strval(tmp);
        tmp = strtok(inputtext,idx);
        GetPlayerName(id, playername, sizeof(playername));
       
        format(string,sizeof(string),"Name: %s\nWanted Level: %d",playername,GetPlayerWantedLevel(id));
        ShowPlayerDialog(playerid,22,DIALOG_STYLE_MSGBOX,"Info",string,"Ok","Cancel");
   
    }
Код:
C:\Users\Michael\Desktop\Samp scvripting\gamemodes\roleplay.pwn(1140) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
error line
pawn Код:
tmp = strtok(inputtext,idx);
Reply
#2

Your code doesn't make any sense anyway, you're storing the entered ID before even splitting the string to get the ID! In fact I don't know why you're even splitting the string using strtok because you never even use another part of it! I would instead suggest merely converting the string straight to an integer and checking if the player is connected:

pawn Код:
if (dialogid == 21)
{
    new
        string[128],
        id = strval(inputtext);

    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,red,"[ERROR]: Player is not connected!");
    GetPlayerName(id, playername, sizeof(playername));
       
    format(string,sizeof(string),"Name: %s\nWanted Level: %d",playername,GetPlayerWantedLevel(id));
    ShowPlayerDialog(playerid,22,DIALOG_STYLE_MSGBOX,"Info",string,"Ok","Cancel");
}
Reply
#3

Ah yes. I understand.

Thankyou, it works fine now.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)