One skin per person??
#1

Hello I need help, I want the players can not use a skin already in use could not find information about it so I ask them for help ... thanks

getplayerskin think can help (=
Reply
#2

Hmm maybe you can use a varriable in OnPlayerRequestClass() and then check if some skin is in use..
for example:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            skin_id0_in_use = 1;
            if(skin_id0_in_use == 1)
                return GameTextForPlayer(playerid, "~r~This skin is already in use!", 5000, 3);
        }
        case 1:
        {
            skin_id1_in_use = 1;
            if(skin_id1_in_use == 1)
                return GameTextForPlayer(playerid, "~r~This skin is already in use!", 5000, 3);
        }
    }
    return 1;
}
Idk if this is what you want
Reply
#3

Try something like

pawn Код:
new usedSkins[300];

public OnPlayerRequestSpawn(playerid)
{
    new skin = GetPlayerSkin(playerid);
    if(usedSkins[skin])
        return 0: // return 0 to prevent them from spawning

    usedSkins[skin] = 1;
}
I wrote this out on my iPad so my apologies if there is any mistakes, you also would have to set the variable back to 0 whenever they disconnect, now that I think about it you would also have to set it back to 0 if the player changes his character a second time, a better way to do it would be to set the variable under player spawn/death

It's late now but I'll fix it up tomorrow
Reply
#4

Quote:
Originally Posted by PinkFloydLover
Посмотреть сообщение
Try something like

pawn Код:
new usedSkins[300];

public OnPlayerRequestSpawn(playerid)
{
    new skin = GetPlayerSkin(playerid);
    if(usedSkins[skin])
        return 0: // return 0 to prevent them from spawning

    usedSkins[skin] = 1;
}
I wrote this out on my iPad so my apologies if there is any mistakes, you also would have to set the variable back to 0 whenever they disconnect, now that I think about it you would also have to set it back to 0 if the player changes his character a second time, a better way to do it would be to set the variable under player spawn/death

It's late now but I'll fix it up tomorrow
1287 error 017: undefined symbol "usedSkins"
1287 error 001: expected token: ";", but found "]"
1287 error 029: invalid expression, assumed zero
1287 fatal error 107: too many error messages on one line


Lines
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
  1287  new skin = GetPlayerSkin(playerid);
   1288 if(usedSkins[skin])
    1289    return 0: // return 0 to prevent them from spawning

   1290 usedSkins[skin] = 1;
}
Reply
#5

Quote:
Originally Posted by Jacapo
Посмотреть сообщение
Hmm maybe you can use a varriable in OnPlayerRequestClass() and then check if some skin is in use..
for example:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            skin_id0_in_use = 1;
            if(skin_id0_in_use == 1)
                return GameTextForPlayer(playerid, "~r~This skin is already in use!", 5000, 3);
        }
        case 1:
        {
            skin_id1_in_use = 1;
            if(skin_id1_in_use == 1)
                return GameTextForPlayer(playerid, "~r~This skin is already in use!", 5000, 3);
        }
    }
    return 1;
}
Idk if this is what you want







ERRORS:


(87 : error 017: undefined symbol "skin_id0_in_use"
(879) : error 017: undefined symbol "skin_id0_in_use"
(884) : error 017: undefined symbol "skin_id1_in_use"
(885) : error 017: undefined symbol "skin_id1_in_use"

HELP PLS (=
Reply
#6

Dont just copy..
You must define(it is only for example/idea), so:
new skin_id0_in_use = 0;
new skin_id1_in_use = 0;
..
or use script by: PinkFloydLover
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)