Help with making a faction
#1

I use zcmd and I try to make a command /setleader1 that would make a .ini file for SFPD in factions folder. I made it like I made PlayerInfo thing but for some reason the command wont execute and I get a message SERVER: Unknown command.

This is my code:
Код:
COMMAND:setleader1(playerid, params[])
	{
		new leaderid;
		new getname[30];
	   	if(sscanf(params, "i", leaderid)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setleader1 [playerID]");
        dini_Create(SERVER_FACTION_SFPD_FILE);
        dini_IntSet(SERVER_FACTION_SFPD_FILE, "Leaderl",FactionSFPD[playerid][fLeader] = GetPlayerName(leaderid, getname, 30));
		return 1;
	}
Please help me out a bit. Thanks
Reply
#2

First of all, this makes more sense:

pawn Код:
GetPlayerName(leaderid, FactionSFPD[playerid][fLeader], 30)
dini_IntSet(SERVER_FACTION_SFPD_FILE, "Leaderl",FactionSFPD[playerid][fLeader]);
Which means there's no need for that wasteful allocation of memory that is new getname[30];

Next, are you sure you're defining fLeader as an array? Lets see the enum where you create it.
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
First of all, this makes more sense:

pawn Код:
GetPlayerName(leaderid, FactionSFPD[playerid][fLeader], 30)
dini_IntSet(SERVER_FACTION_SFPD_FILE, "Leaderl",FactionSFPD[playerid][fLeader]);
Which means there's no need for that wasteful allocation of memory that is new getname[30];

Next, are you sure you're defining fLeader as an array? Lets see the enum where you create it.
Here it is:
Код:
enum fFactionSFPD
{
    fLeader[30],
    fFactionName,
    fRank1,
    fRank2,
    fRank3,
    fRank4,
    fRank5,
    fSkin1,
    fSkin2,
    fSkin3,
    fSkin4,
    fSkin5,
    fSkin6,
}
Reply
#4

Okay, well have you tried the code I pasted?
Reply
#5

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Okay, well have you tried the code I pasted?
Yes but the command is not recognized. It says SERVER: Unknown command.
Reply
#6

Well that must be something to do with your command processor then, and I don't use ZCMD so I wouldn't know what the issue is there.
Reply
#7

Thanks anyway.

Anyone else has a suggestion to solve this?
Reply
#8

You may forgot

pawn Код:
#include <zcmd>
Also I've tried once ZCMD, and got same thing as you: "Unknown command". Why dont you use strcmp + sscanf? Or even dcmd, which on this situation, doesn't needs sscanf
Reply
#9

Quote:
Originally Posted by blackwave
Посмотреть сообщение
You may forgot

pawn Код:
#include <zcmd>
Also I've tried once ZCMD, and got same thing as you: "Unknown command". Why dont you use strcmp + sscanf? Or even dcmd, which on this situation, doesn't needs sscanf
All my other zcmd commands work. What's the difference between ZCMD and DCMD?
Reply
#10

Paste the line of code where you declare your enum (the 'new' part).

Quote:
Originally Posted by blackwave
Посмотреть сообщение
You may forgot

pawn Код:
#include <zcmd>
Also I've tried once ZCMD, and got same thing as you: "Unknown command". Why dont you use strcmp + sscanf? Or even dcmd, which on this situation, doesn't needs sscanf
dcmd is less efficient than zcmd, why would you recommend a slower method when you haven't even examined the situation properly? zcmd is the most efficient way, and strcmp is the slowest. sscanf returns users by ids/names with the "u" parameter, which the OP should probably use.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)