PDA

View Full Version : Problem command


Johnny_Ionut
03/02/2015, 07:00 PM
Hello
Anyone can help me?
This command doesn't work. Why?
CMD:gethelper(playerid, params[])
{
new tmp[256];
new string[256];
new idx;
tmp = strtok(params, idx);
if(sscanf(params, "ud",params[0],params[1])) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");
if (Info[playerid][pAdmin] >= 4)
{
new stat;
stat = params[0];
switch (stat)
{
case 1:
{
new file = ini_openFile("/leaders.ini");
INI_WriteString(file,"LSPD",params[1]);
format(string, sizeof(string), "LSPD - %s", string);
SendClientMessage(playerid, COLOR_WHITE, string);
ini_closeFile(file);//
}
default:
{
SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
}
}
}
return 1;
}

Johnny_Ionut
03/02/2015, 07:06 PM
I wish you access command (/ gethelper [SLOT] [HELPER]) to edit HELPER1 name which I will add it.

SnG.Scot_MisCuDI
03/02/2015, 07:13 PM
Use sscanf: http://forum.sa-mp.com/showthread.php?t=120356

remove
if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");

use

if(sscanf(params, "is[32]", slot, helper)) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");

Johnny_Ionut
03/02/2015, 07:17 PM
Use sscanf: http://forum.sa-mp.com/showthread.php?t=120356

remove
if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");

use

if(sscanf(params, "is[32]", slot, helper)) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");

ok,but you could do me this command? are started scripting and still do not understand some things.