Big problem with my /skin [ID] script
#1

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.
Reply
#2

anyone? this is very importn't ;(
Reply
#3

Sorry for bump but come on please!
Reply
#4

Come on!
Reply
#5

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
Reply
#6

write your errors
Reply
#7

Example?
Reply
#8

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;
    }
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)