ID bug
#1

everytime i set the skin to other ID's it changes mine ... please help
pawn Код:
CMD:setskin(playerid, params[])
{
    new targetid, skin, sendername[MAX_PLAYER_NAME], receivername[MAX_PLAYER_NAME], string[128];
    if(sscanf(params,"ui", targetid, skin)) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error.Correct usage: /setskin [PlayerID] [Skinmodel]");
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFF,"This command is only for RCON Admins.");
    if(skin > 299 || skin < 1) return SendClientMessage(playerid, 0xFFFFFFF,"Wrong Skin ID! Available ID's: 1-299");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to your server");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(targetid, receivername,sizeof(receivername));
    format(string, sizeof(string),"Your skin have been set to model %d by admin %s", skin, sendername);
    SendClientMessage(targetid, 0xFFFFFF, string);
    format(string, sizeof(string),"You have set %s skin to model %d", receivername, skin);
    SendClientMessage(playerid, 0xFFFFFF, string);
    SetPlayerSkin(targetid, skin); // This will set the target the skin ID the sender want to
    return 1;
}
Reply
#2

PHP код:
CMD:setskin(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 3)
    {
        new 
string[128], giveplayeridskinid;
        if(
sscanf(params"ud"giveplayeridskinid)) return SendClientMessageEx(playeridCOLOR_GREY"USAGE: /setskin [player] [skinid]");

        if(
IsPlayerConnected(giveplayerid))
        {
            if(!
IsInvalidSkin(skinid))
            {
                if(
GetPlayerSkin(giveplayerid) == skinid)
                {
                    
SendClientMessageExplayeridCOLOR_WHITE"The player you're trying to change skins of already is using the skin you're trying to set." );
                }
                else
                {
                    
PlayerInfo[giveplayerid][pModel] = skinid;
                    
format(stringsizeof(string), "Your skin has been changed to ID %d by Administrator %s."skinidGetPlayerNameEx(playerid));
                    
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
                    
format(stringsizeof(string), "You have given %s skin ID %d."GetPlayerNameEx(giveplayerid), skinid);
                    
SendClientMessageEx(playeridCOLOR_WHITEstring);
                    
SetPlayerSkin(giveplayeridPlayerInfo[giveplayerid][pModel]);
                }
            }
            else
            {
                
SendClientMessageEx(playeridCOLOR_GREY"Invalid skin ID!");
            }
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command.");
    }
    return 
1;

Should Work.
Reply
#3

many errors.. can u explain and do it in a better way pls :S?
Reply
#4

Which Errors?


EDIT;
Use my Code.. It Wont Have Errors.
Reply
#5

Quote:
Originally Posted by Sig Hansen
Посмотреть сообщение
Which Errors?


EDIT;
Use my Code.. It Wont Have Errors.
im not using padmin so make it for rcon Dx and wait lemme copy the errors
pawn Код:
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(12) : error 017: undefined symbol "SendClientMessageEx"
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(16) : error 017: undefined symbol "IsInvalidSkin"
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(20) : error 017: undefined symbol "SendClientMessageEx"
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(24) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(24) : warning 215: expression has no effect
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(24) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(24) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\SAMP\filterscripts\ss.pwn(24) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Reply
#6

pawn Код:
CMD:setskin ( playerid , params [] )
{
    new ID , sID ;
    if ( sscanf ( params , "ui" , ID , sID ) ) return SendClientMessage ( playerid , 0xFFFFFFF , "Syntax error.Correct usage: /setskin [PlayerID] [Skinmodel]" ) ;
    if ( !IsPlayerAdmin ( playerid ) ) return SendClientMessage ( playerid , 0xFFFFFFF , "This command is only for RCON Admins." ) ;
    if ( sID > 299 || sID < 1 ) return SendClientMessage ( playerid , 0xFFFFFFF , "Wrong Skin ID! Available ID's: 1-299" ) ;
    if ( !IsPlayerConnected ( ID ) ) return SendClientMessage ( playerid , 0xFFFFFFF , "That player is not connected to your server" ) ;
    else
    {
        new tName [ MAX_PLAYER_NAME ] , aName [ MAX_PLAYER_NAME ] , Str [ 128 ] ;
        GetPlayerName ( playerid , aName , sizeof ( aName ) ) ;
        GetPlayerName ( ID , tName , sizeof ( tName ) ) ;
        format ( Str , 128 , "Your skin have been set to model %d by admin %s" , sID , aName ) ;
        SendClientMessage ( ID , 0xFFFFFF , Str ) ;
        format ( Str , 128 , "You have set %s skin to model %d" , tName , ID ) ;
        SendClientMessage ( playerid , 0xFFFFFF , Str ) ;
        SetPlayerSkin ( ID , sID ) ; // This will set the target the skin ID the sender want to
    }
    return 1 ;
}
This should work, Haven't tested though.

EDIT: Forgot to change the skin to sID.
Reply
#7

you forgot to define "skin" but np it compiled and im gonna test it, ty
Reply
#8

Quote:
Originally Posted by xMCx
Посмотреть сообщение
you forgot to define "skin" but np it compiled and im gonna test it, ty
Oh, well. A little typo.
Reply
#9

my id is 0
i setskin for ids 1,2,10etc
it changes mine..
Reply
#10

Quote:
Originally Posted by xMCx
Посмотреть сообщение
my id is 0
i setskin for ids 1,2,10etc
it changes mine..
Update your sscanf include+plugin, i had this problem and i fixed it with the update
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)