Command error
#1

Hey all. I have an error in my command:

pawn Код:
COMMAND:setleader(playerid,params[])
    {
    new id,file[40],faction[40];
    if(PlayerInfo[playerid][pAdminLevel] <2)return SendClientMessage(playerid,COLOR_RED,"You're not allowed to do this.");
    if(sscanf(params,"us",id,faction)) return SendClientMessage(playerid,COLOR_GREY,"USAGE:/setleader [playerid] [faction]");
    format(file,sizeof(file),"%s.ini",faction); // format file , file ? xD hmm xD , u need an important check here , u need to check if the person the admin is choosing is already in the same faction or not because if he is in another faction that would make a mess
    if(fexist(file)) //its messed up Jup I see allow me to fix it? Sure :D
    {
    if(PlayerInfo[id][Faction] != strval(faction)) return SendClientMessage(playerid,COLOR_RED,"That Player Doesn't Belong To That Faction");
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player Is Not Connected");
    else
    {
    new string[128];
    new pName[24]; GetPlayerName(id,pName,24);
    dini_Set(file,"Owner",pName);
    format(string,sizeof(string),"Succesfully maded %s owner",pName);
    SendClientMessage(playerid,COLOR_YELLOW,string);
    format(string,128,"Your Faction is : %s",PlayerInfo[id][Faction]);
    SendClientMessage(id,COLOR_YELLOW,string);
    PlayerInfo[playerid][Faction] = faction;
 }
 }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "This faction doesn't exists");
    }
    return 1;
    }
Error line:
pawn Код:
PlayerInfo[playerid][Faction] = faction;
Код:
C:\Users\Bart\Desktop\SampScripting\gamemodes\Sunlight.pwn(497) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please help
Reply
#2

pawn Код:
PlayerInfo[id][Faction] = strval(faction);
Reply
#3

Quote:
Originally Posted by Donya
Посмотреть сообщение
pawn Код:
PlayerInfo[id][Faction] = strval(faction);
Nothing changed in the user file
Reply
#4

pawn Код:
enum PlayerInfo
{
faction,
};
WAT?
Reply
#5

You can format it:
pawn Код:
format(PlayerInfo[id][Faction], 40, "%s", faction);
Reply
#6

Make sure in your Enum definition you include this:
pawn Код:
enum PlayerInfo
{
     Faction[40], //It is a string, so it needs to have a size.
    // rest
}
Or, you need to change your second param in the sscanf line to an integer, and then use strval. It looks like this is what you're doing everywhere else in the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)