SA-MP Forums Archive
help[+rep] - 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: help[+rep] (/showthread.php?tid=357759)



help[+rep] - ZBits - 08.07.2012

hello i want some help a command /duty

when a player does /duty his skin gets changed to the cop skin,and now when he wants to go off duty he types /offduty he gets back his skin which he had before going on duty


Re: help[+rep] - Roko_foko - 08.07.2012

pawn Код:
OnPlayerCommandText(blag blaf)
{
    if(!strcmp("/duty",cmdtext,true,4)){
    SetPlayerSkin(playerid,POLICEMANSKIN_ID);
    return 1;
    }
    if(!strcmp("/offduty",cmdtext,true, 7)){
    SetPlayerSkin(playerid,PLAYERSKIN_ID);
    return 1;
    }
}
Skins find at samp-wiki


Re: help[+rep] - Lordzy - 08.07.2012

CMD:duty(playerid, params[ ])
{
SetPlayerSkin(playerid,copskin);
return 1;
}


Re: help[+rep] - clarencecuzz - 08.07.2012

pawn Код:
new OnDuty[MAX_PLAYERS];
new OffDutySkin[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
OnDuty[playerid] = 0;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/duty", true) == 0)
    {
        if(OnDuty[playerid] == 0)
        {
        OffDutySkin[playerid] = GetPlayerSkin(playerid);
        SetPlayerSkin(playerid, 280); //Change 280 to whatever Skin ID you want for a cop.
        SendClientMessage(playerid, 0x00FF00AA, "You are now ON duty.");
        }
        else return SendClientMessage(playerid, 0xFF0000AA, "You are already on duty!");
        return 1;
    }
   
    if(strcmp(cmdtext, "/offduty", true) == 0)
    {
        if(OnDuty[playerid] == 1)
        {
        SetPlayerSkin(playerid, OffDutySkin[playerid]);
        SendClientMessage(playerid, 0x00FF00AA, "You are now OFF duty.");
        }
        else return SendClientMessage(playerid, 0xFF0000AA, "You are already off duty!");
        return 1;
    }
    return 1;
}



Re: help[+rep] - ZBits - 08.07.2012

that didnt help at all i want the skin which he had before going on duty


supose i have skin no.101 i go to lspd and type /duty i get the skin number 280,and now when i do /offduty i get back skin no.101

in short i need the same skin which i had before going on duty.


Re: help[+rep] - zombieking - 08.07.2012

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
pawn Код:
new OnDuty[MAX_PLAYERS];
new OffDutySkin[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
OnDuty[playerid] = 0;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/duty", true) == 0)
    {
        if(OnDuty[playerid] == 0)
        {
        OffDutySkin[playerid] = GetPlayerSkin(playerid);
        SetPlayerSkin(playerid, 280); //Change 280 to whatever Skin ID you want for a cop.
        SendClientMessage(playerid, 0x00FF00AA, "You are now ON duty.");
        }
        else return SendClientMessage(playerid, 0xFF0000AA, "You are already on duty!");
        return 1;
    }
   
    if(strcmp(cmdtext, "/offduty", true) == 0)
    {
        if(OnDuty[playerid] == 1)
        {
        SetPlayerSkin(playerid, OffDutySkin[playerid]);
        SendClientMessage(playerid, 0x00FF00AA, "You are now OFF duty.");
        }
        else return SendClientMessage(playerid, 0xFF0000AA, "You are already off duty!");
        return 1;
    }
    return 1;
}
That is exactly what you said.


Re: help[+rep] - ZBits - 08.07.2012

yeah i know i couldnt post back to claren Thanks claren thanks very much