AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SOLVED (https://forums.alliedmods.net/showthread.php?t=293434)

ArthHa 01-31-2017 18:47

SOLVED
 
Hello, i want to create easiest way to use some of effects.

Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_const>

public plugin_init ()
{
register_clcmd( "say /test", "Test" );
}

stock MakeFx(Client,const format[],{_,Float}:...)
{
if(format)
{
switch(format)
{
case "fxLightning":
{
// (sprite index)
// (life in 0.1's)
// (line width in 0.1's)
// (noise amplitude in 0.01's)
// (red)
// (green)
// (blue)
// (brightness)
// (scroll speed in 0.1's)

if(callfunc_begin("fxLightning") )
{
client_print(Client,print_chat,"function called and executed");
}
}
default:
{
//not found
return PLUGIN_HANDLED;
}
}
}
return PLUGIN_HANDLED;
}

public Test(id)
{
MakeFx( id, "fxLightning" );
}

and i get this error:

array must be indexed (variable -"format")

Any ideas?;D

PRoSToTeM@ 01-31-2017 19:25

Re: Make FX help.
 
Use if-else if blocks instead of switch, because switch doesn't support strings. If you want to use switch you can create enumeration for all strings you need and map strings to this enumeration via Trie and switch mapped values which you can get via TrieGetCell.


All times are GMT -4. The time now is 20:53.

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