dcmd halp needed [ New to dcmd ] ( index out of bounds ) - 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: dcmd halp needed [ New to dcmd ] ( index out of bounds ) (
/showthread.php?tid=210005)
dcmd halp needed [ New to dcmd ] ( index out of bounds ) -
FluffyPawZ - 12.01.2011
so im trying to make a simple skin changer,
PHP Code:
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>
#include "../include/gl_common.inc"
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFFF
forward SendPlayerFormattedText(playerid, const str[], define);
//------------------------------------------------------------------------------------------------------
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("DCMD FilterScript");
print("--------------------------------------\n");
return 1;
}
//------------------------------------------------------------------------------------------------------
dcmd_skin(const playerid,const params[]) {
#pragma unused params
new tmp[128];
new skinid = tmp[128];
SetPlayerSkin(playerid, skinid);
return true;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(skin,4,cmdtext);
return 0;
}
//-------------------------------------------------------------------------------------------------------
public SendPlayerFormattedText(playerid, const str[], define)
{
new tmpbuf[256];
format(tmpbuf, sizeof(tmpbuf), str, define);
SendClientMessage(playerid, 0xFF004040, tmpbuf);
}
public OnFilterScriptExit()
{
print("dcmd FilterScript Unloaded");
return 0;
}
#endif
but im getting this
Code:
C:\Server\SA-MP_Server 3.0c\filterscripts\dcmd.pwn(37) : error 032: array index out of bounds (variable "tmp")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
i have only started coding in dcmd as of last night lol......
thanks.
Re: dcmd halp needed [ New to dcmd ] ( index out of bounds ) -
Unknown1234 - 12.01.2011
i used sscanf..
new id;
dcmd_skin(playerid,params[])
if(sscanf(params,"u",id)) SendClientMessage(playerid,0xFF004040,"USAGE:- /skin <id>"); // u - player id...
else
{
SetPlayerSkin(playerid, id);
}
return 1;
}