Little Problem
#1

Why do i get a error when i use this
pawn Код:
SetPlayerColor(playerid,dini_Get(oFile,"Color"));
ERROR IS
pawn Код:
D:\Users\Tanush\Desktop\SA-MP Server Stunt\gamemodes\erclan.pwn(9453) : error 035: argument type mismatch (argument 2)
Reply
#2

(argument 2) means there's something wrong with dini_Get(oFile,"Color")

Why do you use it this way ?, won't it be alot simpler if you use it this way.

PHP код:
SetPlayerColor(playeridcolour
Example:

PHP код:
SetPlayerColor(playerid0xB46F0000); 
Reply
#3

SetPlayerColor this its its own comma try this

pawn Код:
new color = dini_Get(oFile, "Color"));

SetPlayerColor(playerid, color);
I think... I'm not to sure
Reply
#4

@Gameover

Dude he saves player's colour in an .ini file, So when player connects and logs in it just load its colour which was saved in .ini!

Thanks
Reply
#5

Quote:
Originally Posted by Davz*|*Criss
Посмотреть сообщение
@Gameover

Dude he saves player's colour in an .ini file, So when player connects and logs in it just load its colour which was saved in .ini!

Thanks
Well, i don't use dini.. so i don't have much experience in it.

then you should add a new colour

PHP код:
new color dini_Get(oFile,"Color")) 
And it should work fine..
Reply
#6

FOR THE SECOND POST
pawn Код:
D:\Users\Tanush\Desktop\SA-MP Server Stunt\gamemodes\erclan.pwn(9449) : error 033: array must be indexed (variable "-unknown-")
And i need dini_Get because im making a dynamic org so i made /setocolor (set organization color)
pawn Код:
CMD:setocolor(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"ii",orgid,ocolor)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /setocolor [orgid] [samp hex color]");
    format(oFile,sizeof(oFile),"DynamicOrgs/%i.ini",orgid);
    {
        if(!dini_Exists(oFile)) return SendClientMessage(playerid,red,"ERROR: That Organization Id is INVALID!");
        dini_IntSet(oFile,"Color",ocolor);
    }
    return 1;
}
Reply
#7

Aw .. Another case of someone thinking that colors are strings. All colors used within sa:mp scripting are numbers, they're just represented in hex most of the time for easier reading.

You can just save the colors as numbers and read them as numbers. You'll have something like this in the file: 16711935 (which is green, written in decimal notation). This means you'll have to use dini_Int and dini_IntSet instead of dini_Get and dini_Set.
Reply
#8

Thank you Vince but i got a problem, if i do /setocolor 1 0xFF0000FF on the dini file it shows Color=48
pawn Код:
CMD:setocolor(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"is",orgid,ocolor)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /setocolor [orgid] [samp hex color]");
    format(oFile,sizeof(oFile),"DynamicOrgs/%i.ini",orgid);
    {
        if(!dini_Exists(oFile)) return SendClientMessage(playerid,red,"ERROR: That Organization Id is INVALID!");
        dini_IntSet(oFile,"Color",ocolor);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)