SA-MP Forums Archive
Commands - 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: Commands (/showthread.php?tid=318690)



Commands - Swc20 - 16.02.2012

Hi,
How can I make commands for specific "skins" example just only policeman or guards can use a specific command?


Re: Commands - T0pAz - 16.02.2012

Use GetPlayerSkin and check if he is wearing a police skin or not.

Links:
------
GetPlayerSkin - Wiki
Skin List - Wiki


Re: Commands - Swc20 - 16.02.2012

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
Use GetPlayerSkin and check if he is wearing a police skin or not.

Links:
------
GetPlayerSkin - Wiki
Skin List - Wiki
Thanks, But I'm still beginner. So could you paste a example code. I know only how to add commands but not for specified skin. :P


Re: Commands - Mark™ - 16.02.2012

Quote:
Originally Posted by Swc20
Посмотреть сообщение
Thanks, But I'm still beginner. So could you paste a example code. I know only how to add commands but not for specified skin. :P
pawn Код:
playerskin = GetPlayerSkin(playerid);
taken from wiki


Re: Commands - MinazAhmed - 16.02.2012

Check samp wiki main page for any help you need they will provide you with all help.

if i ever helped u please + rep becuz i need to advertise my server.


Re: Commands - Swc20 - 16.02.2012

Quote:
Originally Posted by Xtreme_playa
Посмотреть сообщение
pawn Код:
playerskin = GetPlayerSkin(playerid);
taken from wiki
I need help with another thing. I get this error:
pawn Код:
: warning 217: loose indentation
when i wirte:

pawn Код:
public OnPlayerSpawn(playerid)
{
    playerskin = GetPlayerSkin(playerid);
        if(playerskin == 1)
        {
            SendClientMessage(playerid, 0xFF0000FF, "Skin ID 4");
        }
        if(playerskin == 2)
        {
            SendClientMessage(playerid, 0xFF0000FF, "Skin ID 2");
        }
        if(playerskin == 3)
        {
            SendClientMessage(playerid, 0xFF0000FF, "Skin ID 3");
        }
        if(playerskin == 4)
        {
            SendClientMessage(playerid, 0xFF0000FF, "Skin ID 4");
        }
        if(playerskin == 5)
        {
            SendClientMessage(playerid, 0xFF0000FF, "Skin ID 5");
        }
        if(playerskin == 6)
        {
            SendClientMessage(playerid, 0xFF0000FF, "Skin ID 6");
        }
    return 1;
}



Re: Commands - Konstantinos - 16.02.2012

pawn Код:
public OnPlayerSpawn(playerid)
{
    playerskin = GetPlayerSkin(playerid);
    if(playerskin == 1)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Skin ID 4");
    }
    if(playerskin == 2)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Skin ID 2");
    }
    if(playerskin == 3)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Skin ID 3");
    }
    if(playerskin == 4)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Skin ID 4");
    }
    if(playerskin == 5)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Skin ID 5");
    }
    if(playerskin == 6)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Skin ID 6");
    }
    return 1;
}



Re: Commands - Swc20 - 16.02.2012

Nothing


Re: Commands - Konstantinos - 16.02.2012

pawn Код:
playerskin = GetPlayerSkin( playerid );
if( playerskin >= 5 || playerskin <= 7 )
{
    // The skin is 5 or 6 or 7
}
Also with cases:
pawn Код:
playerskin = GetPlayerSkin( playerid );
switch( playerskin )
{
    case 5 .. 7: //the skins are from 5 to 7 (5, 6, 7)
}
Or if it's like 5, 6, 8 then you have to use it
pawn Код:
playerskin = GetPlayerSkin( playerid );
if( playerskin == 5 || playerskin == 6 || playerskin == 8 )
{
    // The skin is 5 or 6 or 8
}
But you can use also cases.
pawn Код:
playerskin = GetPlayerSkin( playerid );
switch( playerskin )
{
    case 5, 6, 8: // the skin is 5 or 6 or 8
}
Edit: Erm.. You asked me and then edited the post to
Quote:
Originally Posted by Swc20
Посмотреть сообщение
Nothing



Re: Commands - Swc20 - 16.02.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
playerskin = GetPlayerSkin( playerid );
if( playerskin >= 5 || playerskin <= 7 )
{
    // The skin is 5 or 6 or 7
}
Also with cases:
pawn Код:
playerskin = GetPlayerSkin( playerid );
switch( playerskin )
{
    case 5 .. 7: //the skins are from 5 to 7 (5, 6, 7)
}
Or if it's like 5, 6, 8 then you have to use it
pawn Код:
playerskin = GetPlayerSkin( playerid );
if( playerskin == 5 || playerskin == 6 || playerskin == 8 )
{
    // The skin is 5 or 6 or 8
}
But you can use also cases.
pawn Код:
playerskin = GetPlayerSkin( playerid );
switch( playerskin )
{
    case 5, 6, 8: // the skin is 5 or 6 or 8
}
Edit: Erm.. You asked me and then edited the post to
How to make random camera positions, I mean that the camera changes view every 2 second and after 3 views it goes to player skin selection?