[Pedido] /skin [ID] +REP
#1

Bom, eu queria um sistema de /skin [ID] , para que o player que digitar /skin [ID] que apareзe a skin que ele colocou no ID, e tbm a mensagem: "[INFO]: Skin alterada para (tal skin)" . E se caso ele errar o cmd, tipo se ele escrever /skin 888, que apareзa assim: "[ERRO]: ID da Skin invбlida! ID's de 0 a 299!" .
Obrigado.

++REP
Reply
#2

Acho que й isso xD

if(strcmp(cmd,"/skin", true)==0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5){
new tmp[256];
new plid, skin;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "(ERRO) Digite: /skin [id] [skin]");
return 1;
}
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "(ERRO) Digite: /skin [id] [skin]");
return 1;
}
skin = strval(tmp);
if(IsPlayerConnected(plid)){
if(skin >= 0 && skin < 300){
SetPlayerSkin(plid,skin);
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "(INFO) O Administrrador %s (%d) alterou sua skin para: %d", aname,playerid,skin);
SendClientMessage(plid,tcadm, string);
SendClientMessage(playerid, Verde, "(INFO) Comando efetuado com sucesso!");
return 1;
}else{
SendClientMessage(playerid, Vermelho, "(INFO) ID Invalido.");
return 1;
}
}else{
SendClientMessage(playerid, Vermelho, "(ERRO) Jogador nгo conectado.");
return 1;
}
}
}
Reply
#3

Isso й pra Server RPG, meu GM й de TDM.
Reply
#4

pawn Code:
if ( strcmp ( cmd , "/skin" , true ) == 0 )
{
    new skinid ;
    tmp = strtok ( cmdtext , idx ) ;
    if ( !strlen ( tmp ) ) return SendClientMessage ( playerid, -1, "/skin [skin]" ) ;
    skinid = strval ( tmp ) ;
    if ( skinid < 0 || skinid > 300 ) return SendClientMessage ( playerid, -1, "Skin invalida" ) ;
    SetPlayerSkin ( playerid , skinid ) ;
    format ( string , sizeof ( string ) , "Skin %d" , skinid ) ;
    SendClientMessage ( playerid , -1 , string ) ;
    return 1 ;
}
Reply
#5

pawn Code:
C:\Users\Gustavo\Desktop\GTA\Coisas GM\gamemodes\extreme.pwn(4210) : error 017: undefined symbol "cmd"
C:\Users\Gustavo\Desktop\GTA\Coisas GM\gamemodes\extreme.pwn(4213) : error 017: undefined symbol "tmp"
C:\Users\Gustavo\Desktop\GTA\Coisas GM\gamemodes\extreme.pwn(4213) : error 017: undefined symbol "idx"
C:\Users\Gustavo\Desktop\GTA\Coisas GM\gamemodes\extreme.pwn(4214) : error 017: undefined symbol "tmp"
C:\Users\Gustavo\Desktop\GTA\Coisas GM\gamemodes\extreme.pwn(4215) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
OBS: Erros do COD do RoacH` .
Reply
#6

Eu tenho um FS
de dialog por skin
estilo o [FS] Anuncio que postei.
Da uma olhada no FS anuncio ali na minha sign
talvez vou por o de skin por dialog...
Reply
#7

pawn Code:
if(!strcmp(cmdtext, "/skin", true))
{
    new skinid ;
    tmp = strtok ( cmdtext , idx ) ;
    if ( !strlen ( tmp ) ) return SendClientMessage ( playerid, -1, "/skin [skin]" ) ;
    skinid = strval ( tmp ) ;
    if ( skinid < 0 || skinid > 300 ) return SendClientMessage ( playerid, -1, "Skin invalida" ) ;
    SetPlayerSkin ( playerid , skinid ) ;
    format ( string , sizeof ( string ) , "Skin %d" , skinid ) ;
    SendClientMessage ( playerid , -1 , string ) ;
    return 1 ;
}
E Use a Stock "strtok" :

pawn Code:
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#8

pawn Code:
if ( strcmp ( cmdtext , "/skin" , true ) == 0 )
{
    new tmp [ 256 ] , string [ 50 ], idx , skinid ;
    tmp = strtok ( cmdtext , idx ) ;
    if ( !strlen ( tmp ) ) return SendClientMessage ( playerid, -1, "/skin [skin]" ) ;
    skinid = strval ( tmp ) ;
    if ( skinid < 0 || skinid > 300 ) return SendClientMessage ( playerid, -1, "Skin invalida" ) ;
    SetPlayerSkin ( playerid , skinid ) ;
    format ( string , sizeof ( string ) , "Skin %d" , skinid ) ;
    SendClientMessage ( playerid , -1 , string ) ;
    return 1 ;
}
Final do gamemode:

pawn Code:
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
@EDIT /\
Reply
#9

Nгo funcionou.
Reply
#10

pawn Code:
CMD:skin(playerid, params[])
{
    new SkinID;
    if(sscanf(params, "i", SkinID)) return SendClientMessage(playerid, -1, "Use /skin [ID]");
    if(SkinID < 0 || SkinID > 300) return SendClientMessage(playerid, -1, "[ERRO]: ID da Skin invбlida! ID's de 0 a 299!");
    SetPlayerSkin(playerid, SkinID);
    new string[33];
    format(string, sizeof(string), "[INFO]: Skin alterada para (%d)", SkinID);
    SendClientMessage(playerid, -1, string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)