SA-MP Forums Archive
Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - 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)
+--- Thread: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" (/showthread.php?tid=606898)



Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Jabien225 - 11.05.2016

Lines 110 and 114

new cmd[128],idx;
cmd = strtok(cmdtext,idx); LINE 110
if(strcmp(cmd,"/tele",true)==0)
{
new tmp[128];
tmp = strtok(cmdtext,idx); LINE 114
if(strlen(tmp)==0) return SendClientMessage(playerid,BLUE,"Usage: /tele 1");
if(strval(tmp)==1)
SetPlayerPos(playerid,1885.7004,-2592.2048,13.5469);


Error 33 array must be indexed(variable "cmd" and "tmp"


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Jabien225 - 11.05.2016

Help Please


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Micko123 - 11.05.2016

new cmd[128];
cmd=strtok(cmdtext,index);
if(strcmp(cmd, "/tele", true)== 0)
{
new tmp[128];
tmp=strtok(cmdtext,index);
if(strlen(tmp)==0) return SendClientMessage(playerid,BLUE,"Usage: /tele 1");
if(strval(tmp)==1)
SetPlayerPos(playerid,1885.7004,-2592.2048,13.5469);

try that


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Jabien225 - 11.05.2016

error 33 array must be indexed(variables cmd) line 109
error 33 array must be indexed(variables tmp)line 113


new cmd[128],index;
cmd = strtok(cmdtext,index); LINE 109
if(strcmp(cmd,"/tele",true)==0)
{
new tmp[128];
tmp=strtok(cmdtext,index); LINE 113
if(strlen(tmp)==0) return SendClientMessage(playerid,BLUE,"Usage: /tele 1");
if(strval(tmp)==1)
SetPlayerPos(playerid,1885.7004,-2592.2048,13.5469);
return 1;


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Jabien225 - 11.05.2016

I had to do #include index but now its saying
cannot read from file: "index"
how to do a file for it?


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Micko123 - 11.05.2016

Hold on. If you are doing /tele command why don't you do this
Code:
CMD:tele(playerid, params[])
{
    SetPlayerPos(playerid,1885.7004,-2592.2048,13.5469);
    return 1;
}
I don't have time to enter all what you need. But you get the point


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Jabien225 - 11.05.2016

Come on man!


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Eymeric69 - 11.05.2016

Hey yo it's you on samp script gamemode server im interested

and have you do:
Code:
#include <ZCMD>
on the top of your pawn script ?
Have you download zcmd and he is in pawno/include ?
and what is line 106 and 110 ?


Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - BiosMarcel - 11.05.2016

1. start using a command processor
2. if you post code use [php]
3. dont bump your post so fast
4. works totally fine ... :

PHP Code:
    new cmd[128],idx;
    
cmd strtok(cmdtext,idx);
    if(
strcmp(cmd,"/tele",true)==0)
    {
        new 
tmp[128];
        
tmp strtok(cmdtext,idx);
        if(
strlen(tmp)==0) return SendClientMessage(playerid,BLUE,"Usage: /tele 1");
        if(
strval(tmp)==1)
        
SetPlayerPos(playerid,1885.7004,-2592.2048,13.5469);
    } 



Re: Urgent HELP! Error 33 array must be indexed(variable "cmd" and "tmp" - Dayrion - 11.05.2016

Marcel said some truth. Please read it...
And this command works perfectly.
PHP Code:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[128],idx;
    
cmd strtok(cmdtext,idx);
    if(
strcmp(cmd,"/tele",true)==0)
    {
        new 
tmp[128];
        
tmp strtok(cmdtext,idx);
        if(
strlen(tmp)==0) return SendClientMessage(playerid,BLUE,"Usage: /tele 1");
        if(
strval(tmp)==1)
        
SetPlayerPos(playerid,1885.7004,-2592.2048,13.5469);
        return 
1;
    }
    return 
0;

5. We aren't here to create some stuff for you, we are here to help you create some stuff when you are stuck in your development.