Help please.
#1

Making a filterscript that alows you to create org's simply.
Ran into an error on the process and wondering if someone could help.
So, once i type my command, i't doesnt show the name or save the name, everything else save's fine.
Heres my code :

Код:
dcmd_createorg(playerid, params[])
{
	new tmp1[256], tmp2[256], tmp3[256], tmp4[256],Index;
	tmp1 = strtok(params,Index);
	tmp2 = strtok(params,Index);
	tmp3 = strtok(params,Index);
	tmp4 = strtok(params,Index);
	
	new name = strval(tmp1);
	new color = strval(tmp2);
	new weap1 = strval(tmp3);
	new weap1_ammo = strval(tmp4);
	
	if (IsPlayerAdmin(playerid))
	{
	  if (strlen(tmp1) && strlen(tmp2) && strlen(tmp3) && strlen(tmp4))
	  {
	    new oName[64];
			format(oName, 64, "%s", name);

	    new org[256];
			format(org, sizeof(org), "\\organizations\\%s.ini", oName);
			
			if (!dini_Exists(org))
			{
				dini_Create(org);
				dini_Set(org, "Name", oName);
				dini_IntSet(org, "Color", color);
				dini_IntSet(org, "Weapon1", weap1);
				dini_IntSet(org, "Weapon1_Ammo", weap1_ammo);
			}

	    new string[256];
	    format(string, sizeof(string), "~ You have created '%s'.", oName);
	    SendClientMessage(playerid, COLOR_ORANGE, string);
	  }
	  else
	  {
	    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createorg [name] [color id] [weapon1] [weapon1 ammo]");
		}
	}
	else
	{
		return 0;
	}
	return 1;
}
Thanks
Reply
#2

maybey you can post the error to ?
would be a little easyier to look for the mistake
i know im lazy

Gr Artix
Reply
#3

I compiled this on my computer and it went well...

dcmd_createorg(playerid, params[])
{
tmp1[256], tmp2[256], tmp3[256], tmp4[256],Index;
tmp1 = strtok(params,Index);
tmp2 = strtok(params,Index);
tmp3 = strtok(params,Index);
tmp4 = strtok(params,Index);

name = strval(tmp1);
color = strval(tmp2);
weap1 = strval(tmp3);
weap1_ammo = strval(tmp4);

(IsPlayerAdmin(playerid))
{
(strlen(tmp1) && strlen(tmp2) && strlen(tmp3) && strlen(tmp4))
{
if oName[64];
format(oName, 64, "%s", name);

if org[256];
format(org, sizeof(org), "\\organizations\\%s.ini", oName);

(!dini_Exists(org))
{
dini_Create(org);
dini_Set(org, "Name", oName);
dini_IntSet(org, "Color", color);
dini_IntSet(org, "Weapon1", weap1);
dini_IntSet(org, "Weapon1_Ammo", weap1_ammo);
}
string[256];
format(string, sizeof(string), oName);
SendClientMessage(playerid, ORANGE, "You have created '%s'.");
}
else
{
SendClientMessage(playerid, WHITE, "USAGE: /createorg [name] [color id] [weapon1] [weapon1 ammo]");
}
}
else
{
return 1;
}
return 0;
}

If it says 1 Error still close the compiler thing and open where you saved it to and it still should be there

I swapped some things around to make it right!
Reply
#4

where do i put that in my script?
Reply
#5

Quote:
Originally Posted by tanush
where do i put that in my script?
Make something of your own.
Dont steal other peoples idea's.

[Doppeyy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)