SA-MP Forums Archive
Command Doesn't Work - 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)
+--- Thread: Command Doesn't Work (/showthread.php?tid=387095)



Command Doesn't Work - Dixon_Smith - 23.10.2012

This Command Doesn't work(like all commands like this), I think the reason it because I try to use the command on player, and I do somthing wrong..

The Command:
PHP код:
if(strcmp(cmd,"/MakeHelper",true) == 0)
    {
        if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][Admin] >= 1338 || PlayerInfo[playerid][Helper] >= 5)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))return SendClientMessage(playerid, -1"USAGE: /MakeHelper [PlayerID] [HelperLevel]");
            
id ReturnUser(tmp);
            
tmp strtok(cmdtextidx);
            new 
level strval(tmp);
            if(
id == INVALID_PLAYER_ID)return SendClientMessage(playerid, -1"Invalid Player ID");
            
PlayerInfo[id][Helper] = level;
            
DOF2_SetInt(pFile(id), "Helper"PlayerInfo[id][Helper]);
            
DOF2_SaveFile();
            if(
PlayerInfo[playerid][Admin] >= 1338)
            {
                
format(stringsizeof(string), "Admin %s Give To You Helper Level: %d",sendernamelevel);
                
SendClientMessage(id, -1string);
                
format(stringsizeof(string), "Admin %s Give To %s Helper Level: %d",sendernamegiveplayerlevel);
                
ABroadCast(COLOR_YELLOWstring1);
            }
            if(
PlayerInfo[playerid][Helper] >= 5)
            {
                
format(stringsizeof(string), "Helper %s Give To You Helper Level: %d",sendernamelevel);
                
SendClientMessage(id, -1string);
                
format(stringsizeof(string), "Helper %s Give To %s Helper Level: %d",sendernamegiveplayerlevel);
                
HBroadCast(COLOR_YELLOWstring1);
            }
        } else { 
DenyMessage(playerid); }
        return 
1;
     } 
The Stocks:
PHP код:
#include <a_samp>
strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' ')) index++;
    new 
offset indexresult[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;
}
stock ReturnUser(text[], playerid INVALID_PLAYER_ID)
{
    new 
pos 0;
    while (
text[pos] < 0x21// Strip out leading spaces
    
{
        if (
text[pos] == 0) return INVALID_PLAYER_ID// No passed text
        
pos++;
    }
    new 
userid INVALID_PLAYER_ID;
    if (
IsNumeric(text[pos])) // Check whole passed string
    
{
        
// If they have a numeric name you have a problem (although names are checked on id failure)
        
userid strval(text[pos]);
        if (
userid >=&& userid MAX_PLAYERS)
        {
            if(!
IsPlayerConnected(userid))
            {
                
userid INVALID_PLAYER_ID;
            }
            else
            {
                return 
userid// A player was found
            
}
        }
    }
    
// They entered [part of] a name or the id search failed (check names just incase)
    
new len strlen(text[pos]);
    new 
count 0;
    new 
name[MAX_PLAYER_NAME];
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i))
        {
            
GetPlayerName(inamesizeof (name));
            if (
strcmp(nametext[pos], truelen) == 0// Check segment of name
            
{
                if (
len == strlen(name)) // Exact match
                
{
                    return 
i// Return the exact player on an exact match
                
}
                else 
// Partial match
                
{
                    
count++;
                    
userid i;
                }
            }
        }
    }
    if (
count != 1)
    {
        if (
playerid != INVALID_PLAYER_ID)
        {
            if (
count)
            {
                
SendClientMessage(playerid0xFF0000AA"Multiple users found, please narrow search.");
            }
            else
            {
                
SendClientMessage(playerid0xFF0000AA"No matching user found.");
            }
        }
        
userid INVALID_PLAYER_ID;
    }
    return 
userid// INVALID_PLAYER_ID for bad return
}
IsNumeric(const string[])
{
    for (new 
0strlen(string); ji++)
    {
        if (
string[i] > '9' || string[i] < '0') return 0;
    }
    return 
1;
}
stock strrest(const string[],index)
{
    new 
length strlen(string),offset index,result[256];
    while((
index length) && ((index offset) < (sizeof(result) - 1)) && (string[index] > '\r')) result[index offset] = string[index],index++;
    
result[index offset] = EOS;
    if(
result[0] == ' ' && string[0] != ' 'strdel(result,0,1);
    return 
result;

What The Problem Please Help Me ..


Re: Command Doesn't Work - Red_Dragon. - 23.10.2012

Any errors or warnings while compiling ? and what does it show when you type the command ?


Re: Command Doesn't Work - Dixon_Smith - 23.10.2012

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
Any errors or warnings while compiling ? and what does it show when you type the command ?
Have Not Any warning or errors, when im type the commands nothing happens


Re: Command Doesn't Work - Red_Dragon. - 23.10.2012

Is the player your making other helpers with (you) an admin of level 1338 ?


Re: Command Doesn't Work - Dixon_Smith - 23.10.2012

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
Is the player your making other helpers with (you) an admin of level 1338 ?
Im Connecting To The RCON
PHP код:
if(IsPlayerAdmin(playerid



Re: Command Doesn't Work - Red_Dragon. - 23.10.2012

Try to make yourself admin in the USER file in SCRIPTFILES i do not think RCON works on that Commands


Re: Command Doesn't Work - Dixon_Smith - 23.10.2012

Im try this it doesn't work but im discoverd no one of my commands in the filterscript worked, I dont know why like simple command :
PHP код:
if(strcmp(cmdtext,"/AdminMe",true) == 0)
    {
        
PlayerInfo[playerid][Admin] = 5000;
        
DOF2_SetInt(pFile(playerid), "Admin"PlayerInfo[playerid][Admin]);
        return 
1;
    }