problem with enum and arrays
#1

hey sciprters
I got this variable
enum pInfo{
pUnit[32],
}
new PlayerInfo[MAX_PLAYERS][pInfo];
I got this command
Код:
dcmd_unitset(playerid, params[])
{
	new id,unit[32];
	if(!sscanf(params,"us[32]",id,unit))
	{
	    if(PlayerInfo[playerid][pCop] > 5)
	    {
	    PlayerInfo[id][pUnit] = unit;
	    new pName[MAX_PLAYER_NAME],victim[MAX_PLAYER_NAME];
	    GetPlayerName(id,victim,sizeof(victim));
	    GetPlayerName(playerid,pName,sizeof(pName));
		new string[256];
		format(string,sizeof(string),"%s has set your unit name to %s",pName,unit);
		SendClientMessage(id,COLOR_ADMINS,string);
		format(string,sizeof(string),"You have set %s's unit name to %s.",victim,unit);
		SendClientMessage(playerid,COLOR_ADMINS,string);
	    }else return SendClientMessage(playerid,COLOR_AFOR,"Your rank doesnt allow you to use this tool !");
	}else return SendClientMessage(playerid,COLOR_RED,"Usage : /unitset [PLAYERID][UNITNAME]");
	return 1;
}
so that makes the player unit anything he wants . and it is working fine .

but when I quit the game I want to save the player's unit name in dini .

So I tried to do this
dini_Set(file,"pUnit",PlayerInfo[playerid][pUnit] = "tiger2");
and it says
error 047: array sizes do not match, or destination array is too small
Reply
#2

Yeah, use format and not = "tiger2"
Reply
#3

you mean like
new string[32];
format(string,sizeof(string),"%s",X);
I dont get it
what to do
Reply
#4

pawn Код:
new string[30];
format(string,sizeof string,"tiger2");
dini_Set(file,"pUnit",string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)