Raised This Month: $ Target: $400
 0% 

array must be indexed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-05-2009 , 11:16   Re: array must be indexed
Reply With Quote #1

1. You are trying to pass only the last array element in your string to the function. ChoosedNumber(id, num[3]);
2. You are trying to compare if a number is == a string, which will not work. if(cpu_number == num)

PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_plugin("Plugin""1.0"".nnnnn1")
    
register_clcmd("say""SayCommand"0);
}

public 
SayCommand(id
{
    new 
message[256];
    
read_args(message255);
    
    if (
containi(message"/try ") == 1
    {
        new 
num[4];
        
read_args(num3);
        
ChoosedNumber(idstr_to_num(num) );
    }
}

ChoosedNumber(idnum
{
    new 
cpu_number random_num(0100);
    
    
client_print(idprint_chat"Your number = %d. cpu number = %d. These numbers %s."numcpu_number , (cpu_number == num) ? "match" "do not match");

__________________

Last edited by Bugsy; 04-05-2009 at 11:21.
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode