This command ruins my serverstart
#1

Well yes, this command
pawn Код:
new levels,Nam[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME],ID;
CMD:setclan(playerid, params[])
{
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setclan [ID] [Clan 1-4]");
    if(levels > 4) return SendClientMessage(playerid,0xFF0000FF,"CLANS AVAILABLE 1-4!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF0000,"That user is not connected.");
    if(Clan[playerid] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already in this clan!");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(Clan[playerid] ==  0)
    {
        new string[128];
        format(string, sizeof(string),"%s has assigned you to %s on the server.",Nam,GetClanName(playerid));
        SendClientMessage(ID,0xFF9900AA,string);
        format(string, sizeof(string),"You have assigned %s  to %s!",pname,GetClanName(playerid));
        SendClientMessage(playerid,0xFF9900AA,string);
        Clan[playerid] = levels;
        return 1;
    }
    new string[128];
    format(string, sizeof(string),"%s has assigned you to %s on the server.",Nam,GetClanName(playerid));
    SendClientMessage(ID,0xFF9900AA,string);
    format(string, sizeof(string),"You have assigned %s  to %s!",pname,GetClanName(playerid));
    SendClientMessage(playerid,0xFF9900AA,string);
    Clan[playerid] = levels;
    return 1;
}


stock GetClanName(playerid)
{
    new string[56];
    if(Clan[playerid] == 1)
    {
        string = "Griffing";
    }
    if(Clan[playerid] == 2)
    {
        string = "Smygard";
    }
    if(Clan[playerid] == 3)
    {
        string = "Hеsblеs";
    }
    if(Clan[playerid] == 4)
    {
        string = "Ravnklo";
    }
    return string;
}
Makes:
Runtime error, file/function not found.

The getclanname stock works. I can run the server if i remove the /setclan command
Reply
#2

Have you got sscanf plugin and include?
Reply
#3

You can't set strings like that. Use format, strmid or strins.
Reply
#4

Quote:
Originally Posted by Seif-
Посмотреть сообщение
You can't set strings like that. Use format, strmid or strins.
What you mean now
Reply
#5

If it gives file or function not found run time error, then as SilentSoul said, you probably haven't load sscanf plugin which is needed for the command. Load nativechecker plugin and add it last to the plugins line in server.cfg. It will print what functions are not registered.

Quote:
Originally Posted by Seif-
Посмотреть сообщение
You can't set strings like that. Use format, strmid or strins.
Are you referring to this?
pawn Код:
stock GetClanName(playerid)
{
    new string[56];
    if(Clan[playerid] == 1)
    {
        string = "Griffing";
    }
    if(Clan[playerid] == 2)
    {
        string = "Smygard";
    }
    if(Clan[playerid] == 3)
    {
        string = "Hеsblеs";
    }
    if(Clan[playerid] == 4)
    {
        string = "Ravnklo";
    }
    return string;
}
If yes, then we can set strings like that and it's a valid one. You can also do:
pawn Код:
new string[6] = "Seif-";
Format is not recommended at all since it's pretty much slow.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)