Help please. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help please. (
/showthread.php?tid=218169)
Help please. -
bartje01 - 29.01.2011
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);
Re: Help please. -
JaTochNietDan - 29.01.2011
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");
}
Re: Help please. -
bartje01 - 29.01.2011
Ah yes. I understand.
Thankyou, it works fine now.