#1

Hello. I am trying to learn how to script, and I am starting off with a simple roleplay server with factions, jobs and what not. When you spawn, It will give them a choice to change skin with /skin. However, if you go below 0 or above 299 the game crashes, and you can not log in untill the skin is changed manually through the playerfile.

I tried to make a simple fix to that, however it don't seem to be working. It stops if it is below 0, but if it is over 299 it will successfully apply the skin and crash everyone around and bug the playerfile.

pawn Код:
CMD:skin(playerid, params[])
{
    new skin = strval(params);
    if(skin < 0 || skin > 299)
    {
        SendClientMessage(playerid, -1, "Valid skin IDs are 0 - 299");
    }
    if(skinchange[playerid] == 1)
    {
    PlayerInfo[playerid][pSkin] = strval(params);
    SetPlayerSkin(playerid, strval(params));
    skinchange[playerid] = 0;
    }
    else
    {
        SendClientMessage(playerid, -1, "You don't have a free skin change.");
    }
    return 1;
}
Any help is appreciated.
Reply
#2

PHP код:
CMD:setskin(playeridparams[])
{
        new 
skin;
        if(
sscanf(params"u"skin)) return SendClientMessage(playerid, -1"[USAGE]: /setskin [SkinID]");//this will send an error message id he entered the wrong format or wrong id etc.
        
if(skin || skin 299) return SendClientMessage(playerid, -1"[USAGE]: Invalid skin!");//you know that there are only 299 skins in samp.if he enters a invalid skin id like 300 or so on,he will get an error message.
        
SetPlayerSkin(playeridskin);//finally if everthing goes rite,this will set the player's skin you wanted.
        
return 1;

use this,explained some.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)