Need help and input on errors! - 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: Need help and input on errors! (
/showthread.php?tid=189190)
Need help and input on errors! -
mtywe - 10.11.2010
I am coding my own vehicle system, and i keep getting 2 index errors or somthing... i need ot know what im doing wrong........ heres the error and the code that it is showing fo the errors...
I put:
cmd = strtok(cmdtext, idx);
resulting in the error: error 033: array must be indexed (variable "cmd")
then: tmp = strtok(cmdtext, idx)
resulting in the error: error 033: array must be indexed (variable "tmp")
Thanks ahead of time for any help given
Re: Need help and input on errors! -
rs.pect - 10.11.2010
cmd and tmp need to be strings:
pawn Код:
new tmp[255]; //255 is dependent to size in strtok
new cmd[255];
or you don't have strtok in your script.
Re: Need help and input on errors! -
mtywe - 10.11.2010
i have it as this
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new string[256];
new cmd[256];
new tmp[256];
new sendername[MAX_PLAYER_NAME];
cmd = strtok (cmdtext, idx);
new vehid = GetPlayerVehicleID(playerid);
if(strcmp(cmd,"/car",true)==0)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_WHITE,"Need vehicle ownership help? Type: /car help");
return 1;
}