SA-MP Forums Archive
Please help me - 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: Please help me (/showthread.php?tid=299710)



Please help me - GAMER_PS2 - 27.11.2011

Heres the deal i have problem with my setskin yeah it works but it still sending
saying "%s has change skin model to 299" (example my skin is 299) it send to player
like this "You already using that skin model" but it keeps announcing to everyone
that i change to skin model 299 that i already use i want to block it. heres the code

pawn Код:
CMD:setskin(playerid, params[])
{
    new skin, skinid, pname[MAX_PLAYER_NAME], string[128];
    skinid = GetPlayerSkin(playerid);
    if(sscanf(params,"i", skin)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /setskin <0 - 299>");
    if(skin > 299 || skin < 0) return SendClientMessage(playerid,COLOR_RED,"Invalid Skin ID! <0 - 299>");
    GetPlayerName(playerid, pname,sizeof(pname));
    format(string, sizeof(string),"%s has changed skin model to %i", pname,skin);
    SendClientMessageToAll(COLOR_GREEN,string);
    format(string, sizeof(string),"Your skin have been set to %d", skin);
    SendClientMessage(playerid,COLOR_GREEN, string);
    if(skin == skinid) return SendClientMessage(playerid,COLOR_RED,"You already using that skin model");
    SetPlayerSkin(playerid, skin);
    return 1;
}
also i want to know how to count players (not included yourself) in the server example:

"Theres currently 10 players online in the server" if theres no online it would be
"Theres no currently online in the server".

UPDATE:

ApplyAnimation is not working i put it onplayerrequestclass but nothing happens heres
my code onplayerrequestclass

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    ApplyAnimation(playerid,"DANCING","dnce_M_a",3.1,0,0,0,0,1);
    PlayerPlaySound(playerid, 1185, 0.0, 0.0, 10.0);
    SetPlayerFacingAngle(playerid, 65.6557);
    SetPlayerPos(playerid,-248.4268,1362.1091,68.7860);
    SetPlayerCameraPos(playerid, -255.2794,1365.9083,73.2267);
    SetPlayerCameraLookAt(playerid, -248.4268,1362.1091,68.7860);
    return 1;
}
Please help me


Re: Please help me - Tanush123 - 27.11.2011

pawn Код:
CMD:setskin(playerid, params[])
{
    new skin, skinid, pname[MAX_PLAYER_NAME], string[128],string2[128];
    skinid = GetPlayerSkin(playerid);
    if(sscanf(params,"i", skin)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /setskin <0 - 299>");
    if(skin > 299 || skin < 0) return SendClientMessage(playerid,COLOR_RED,"Invalid Skin ID! <0 - 299>");
    GetPlayerName(playerid, pname,sizeof(pname));
    format(string, sizeof(string),"%s has changed skin model to %i", pname,skin);
    SendClientMessageToAll(COLOR_GREEN,string);
    format(string2, sizeof(string2),"Your skin have been set to %d", skin);
    SendClientMessage(playerid,COLOR_GREEN, string2);
    if(skin == skinid) return SendClientMessage(playerid,COLOR_RED,"You already using that skin model");
    SetPlayerSkin(playerid, skin);
    return 1;
}



Re: Please help me - GAMER_PS2 - 27.11.2011

it still sending to everyone i want to block it when he already use that skin


Re: Please help me - Tanush123 - 27.11.2011

Oh so you mean when player already have the same skin and uses same skin again it still send to everyone??
pawn Код:
CMD:setskin(playerid, params[])
{
    new skin, skinid, pname[MAX_PLAYER_NAME], string[128];
    skinid = GetPlayerSkin(playerid);
    if(sscanf(params,"i", skin)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /setskin <0 - 299>");
    if(skin == skinid) return SendClientMessage(playerid,COLOR_RED,"You already using that skin model");
    if(skin > 299 || skin < 0) return SendClientMessage(playerid,COLOR_RED,"Invalid Skin ID! <0 - 299>");
    GetPlayerName(playerid, pname,sizeof(pname));
    format(string, sizeof(string),"%s has changed skin model to %i", pname,skin);
    SendClientMessageToAll(COLOR_GREEN,string);
    format(string, sizeof(string),"Your skin have been set to %d", skin);
    SendClientMessage(playerid,COLOR_GREEN, string);
    SetPlayerSkin(playerid, skin);
    return 1;
}
The problem is you have skin == skinid on bottom and it should be under sscanf(params,"i"


Re: Please help me - GAMER_PS2 - 27.11.2011

thanks it work now i want that player counting i need it for my stunt server script


Re: Please help me - GAMER_PS2 - 27.11.2011

Bump.


Re: Please help me - Sinc - 27.11.2011

Quote:
Originally Posted by GAMER_PS2
Посмотреть сообщение
thanks it work now i want that player counting i need it for my stunt server script
pawn Код:
#define for2(MAX_PLAYERS,%1) for(new %1=0;%1<MAX_PLAYERS;%1++) if(IsPlayerConnected(%1))
if (strcmp("/players", cmdtext, true, 10) == 0)
{
    new
        string[156],
        counter
    ;
    for2(MAX_PLAYERS,i) counter++;
    format(string, sizeof(string), "%d", counter);
    SendClientMessage(playerid, -1, string);
    return 1;
}