I got two questions < Please Help Me !
#1

I am going straight on the questions ..

1.
Lets say i got this command in the script:
pawn Код:
if(!strcmp(cmdtext, "/do", true, strlen("/do")))
    {
    new len = strlen("/do");
    if (!strlen(cmdtext[len+1])) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /do [Situation]");
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name);
    format(cmdtext, 128, "* %s ( %s ) ", cmdtext[len+1], name );
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    for(new i, m = GetMaxPlayers(); i < m; i++) if (IsPlayerConnected(i))
    {
    if (IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) SendClientMessage(i, COLOR_PURPLE, cmdtext);
    }
    return 1;
    }
Okay , everything is working alright but the problem is if i type "/dobananas" instead of "/do bananas" it says "ananas (Firstname_Lastname)"
How i can make it says "Unknown command"
PS1 - This problem is for almost all of my commands (/me, /do, /b, /shout, /low and etc.).
PS2 - I am trying to make a RPG server.

2.
I got this script to check if the character is inside clothing shop (interior) and if so you can change your skin by /clothes [Skin ID]:
pawn Код:
new cmd[256];
    if(strcmp(cmd, "/clothes", true) == 0)
    {
    if(IsPlayerInRangeOfPoint(playerid, 15.0, 161.37, -96.61, 1001.80))
    {
    new idx;
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /clothes [Skin ID]");
    return 1;
    }
    new level;
    level = strval(tmp);
    SetPlayerSkin(playerid, level);
    return 1;
    }
   else
  {
     SendClientMessage(playerid, COLOR_RED, "You are not in clothing shop !");
     }
    }
The problem is weird and i can not explain it well but i will try: There is no errors in compiling but In Game it tells me "You are not in clothing shop !" on every command i type.
PS - If you can edit my script or make another which do the same thing :P



PS2 - Dont blame me if you think i am noob - i started to learn how to script just some days ago ! ! !
Reply
#2

1.

im not sure because im new on scripting too but use instead of strlen the 3 number of your letters

Код:
	if(!strcmp(cmdtext, "/do", true, 3))
	{
    if (!cmdtext[3]) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /do [Situation]");
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof name);
	format(cmdtext, 128, "* %s ( %s ) ", cmdtext[4], name );
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	for(new i, m = GetMaxPlayers(); i < m; i++) if (IsPlayerConnected(i))
	{
	if (IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) SendClientMessage(i, COLOR_PURPLE, cmdtext);
	}
	return 1;
	}
hope helped and for the 2 question i dont know.
Reply
#3

2.

You have if statement witch checks if you are 15 units away from position: 161.37, -96.61, 1001.80.
If you arent, it will sent that "You arent in cloth shop" message.
Reply
#4

Quote:
Originally Posted by Assyria
2.

You have if statement witch checks if you are 15 units away from position: 161.37, -96.61, 1001.80.
If you arent, it will sent that "You arent in cloth shop" message.
This isn't his problem. You have something wrong in your OnPlayerCommandText- callback. I have seen this in some gamemode, it was caused by a wrong length of the command.
Reply
#5

Quote:
Originally Posted by billiout
1.

im not sure because im new on scripting too but use instead of strlen the 3 number of your letters

Код:
	if(!strcmp(cmdtext, "/do", true, 3))
	{
    if (!cmdtext[3]) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /do [Situation]");
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof name);
	format(cmdtext, 128, "* %s ( %s ) ", cmdtext[4], name );
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	for(new i, m = GetMaxPlayers(); i < m; i++) if (IsPlayerConnected(i))
	{
	if (IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) SendClientMessage(i, COLOR_PURPLE, cmdtext);
	}
	return 1;
	}
hope helped and for the 2 question i dont know.
Sorry but doesnt works
Please help me and if you can edit my script (on the second problem) so its works.

PS - Oh and please dont give not tested and not working scripts, this doesnt helps almost nobody (especelly newbies)
Reply
#6

Bump: Please guys , i really need to deal with those problems .
Reply
#7

Hmmmmm.....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)