SA-MP Forums Archive
Help In Function - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help In Function (/showthread.php?tid=319049)



Help In Function - lordturhan - 17.02.2012

pawn Код:
stock Rank(playerid)
{
    new Rankk[120];
    switch(GetPlayerScore(playerid))
    {
        case 0..10: Rankk = "Ex";
        case 10..50: Rankk = "Ex1";
        case 100..200: Rankk= "Ex2";
        case 200..300: Rankk = "Ex3";
        case 300..599: Rankk = "Ex4";
        default: Rankk = "Ex5";
    }
    return Rankk;
}
Example:

pawn Код:
CMD:rank2(playerid, params[])
{
        new string[128];
        format(string, sizeof(string),"Rank Test:%s",Rank(playerid));
        SendClientMessage(RED,playerid,string);
        return 1;
}
Error:
Код:
(208) : error 040: duplicate "case" label (value 10)
(210) : error 040: duplicate "case" label (value 200)
(211) : error 040: duplicate "case" label (value 300)



Re: Help In Function - Toreno - 17.02.2012

You can't write same values on a different case;
pawn Код:
stock Rank(playerid)
{
    new Rankk[120];
    switch(GetPlayerScore(playerid))
    {
        case 0..10: Rankk = "Ex";
        case 11..50: Rankk = "Ex1";
        case 100..200: Rankk= "Ex2";
        case 201..300: Rankk = "Ex3";
        case 301..599: Rankk = "Ex4";
        default: Rankk = "Ex5";
    }
    return Rankk;
}



Re: Help In Function - lordturhan - 17.02.2012

It doesnt send the message


Re: Help In Function - Toreno - 17.02.2012

What it does once you type the command?


Re: Help In Function - lordturhan - 17.02.2012

Nothing no message nothing pretty weird :S


Re: Help In Function - johnnyman1 - 17.02.2012

Код:
CMD:rank2(playerid, params[])
{
        new string[128];
        format(string, sizeof(string),"Rank Test:%s",Rank(playerid));
        SendClientMessage(playerid,RED,string);
        return 1;
}
You mixed up the color parameter with the playerid


Re: Help In Function - Konstantinos - 17.02.2012

Quote:
Originally Posted by johnnyman1
Посмотреть сообщение
Код:
CMD:rank2(playerid, params[])
{
        new string[128];
        format(string, sizeof(string),"Rank Test:%s",Rank(playerid));
        SendClientMessage(playerid,RED,string);
        return 1;
}
You mixed up the color parameter with the playerid
Wow, nice eye!

I can't understand how exactly this doesn't give you an error
pawn Код:
SendClientMessage(RED,playerid,string);



Re: Help In Function - lordturhan - 17.02.2012

-.- Thats just a stupid mistake -.- Anyways thanks its sending message know.

EDIT:

pawn Код:
SendClientMessage(RED,playerid,string);
[/QUOTE]

Yea that confuses me a lot -.-


Re: Help In Function - lordturhan - 17.02.2012

1 more help i want to attach Rank(playerid)

pawn Код:
new Text3D:label = Create3DTextLabel("",WHITE,30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.4);
To this