SA-MP Forums Archive
Big problem with my /skin [ID] script - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Big problem with my /skin [ID] script (/showthread.php?tid=162512)



Big problem with my /skin [ID] script - Jay. - 23.07.2010

pawn Код:
if(!strcmp(cmdtext, "/skin", true, 4))
    {
    if(cmdtext[5]==0) return SendClientMessage(playerid,COLOR_RED2, "USAGE: /skin [skin id]");
    new skin[11];
    strmid(skin,cmdtext[5],0,11);
    if(!strcmp(skin,"0",true)) return SendClientMessage(playerid,COLOR_RED2, "You have entered an Invaild skin ID");
    new skinid = strval(skin);
   
    SetPlayerSkin(playerid, skinid);
    SendClientMessage(playerid,COLOR_YELLOW1,"You have changed your skin.");
    return 1;
    }
Now theres no errors/warnings

but theres a big problem ingame

If you type /skin and a ID over 400 It crashes my game?

Hope you can help thanks.


Re: Big problem with my /skin [ID] script - Jay. - 23.07.2010

anyone? this is very importn't ;(


Re: Big problem with my /skin [ID] script - Jay. - 23.07.2010

Sorry for bump but come on please!


Re: Big problem with my /skin [ID] script - Jay. - 23.07.2010

Come on!


Re: Big problem with my /skin [ID] script - FUNExtreme - 23.07.2010

Just add a check to see if it is a valid id. There will probably be a fix somewhere, try SEARCHING

Btw: Stop double/triple posting


Re: Big problem with my /skin [ID] script - TheKingOfSamp - 23.07.2010

write your errors


Re: Big problem with my /skin [ID] script - Jay. - 23.07.2010

Example?


Re: Big problem with my /skin [ID] script - [DK]JaloNik - 23.07.2010

pawn Код:
if(strcmp(cmd, "/skin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setskin [playerid/PartOfName] [skin id]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if(level > 299 || level < 1) { SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!"); return 1; }
            if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pTester] >= 1)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GiveNameSpace(sendername);
                        GiveNameSpace(giveplayer);
                        PlayerInfo[para1][pModel] = level;
                        format(string, sizeof(string), "Your skin has been changed by Admin/Tester %s", sendername);
                        SendClientMessage(para1, COLOR_WHITE, string);
                        format(string, sizeof(string), "You have given %s skin to %d.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        SetPlayerSkinEx(para1, PlayerInfo[para1][pModel]);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }



Re: Big problem with my /skin [ID] script - FUNExtreme - 23.07.2010

pawn Код:
if(skinid >= 300) return message



Re: Big problem with my /skin [ID] script - Jay. - 23.07.2010

Quote:
Originally Posted by FUNExtreme
Посмотреть сообщение
pawn Код:
if(skinid >= 300) return message
Where to put that?