#1

if(strcmp(cmd, "/setskin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}Foloseste{FFFFFF}: /setskin [playerid/PartOfName] [skin id]");
return 1;
}
new playa;
new health;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
health = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new name[20];
new victim[20];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playa, victim, sizeof(victim));
PlayerInfo[playa][pModel] = health;
PlayerInfo[playa][pChar] = health;
SetPlayerSkin(playa, PlayerInfo[playa][pChar]);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}[Server-In-Lucru RPG]: {FFFFFF}Nu esti autorizat sa folosesti aceasta Comanda.");
}
}
return 1;
}
Reply
#2

Use zcmd+sscanf2 :
https://sampforum.blast.hk/showthread.php?tid=280476

it would :
pawn Code:
#define IsValidSkin(%0) (0 <= %0 <= 299 && %0 != 74)

CMD:setskin(playerid, params[])
{
    new id, skin;
    if(sscanf(params, "ud", id, skin)) return SendClientMessage(playerid, -1, "USAGE: /setskin [Playerid/Part Of Name] [Skin ID]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Error: Player not connected.");
    if(!IsValidSkin(skin)) return SendClientMessage(playerid, -1, "Error: Invalid skin.");
   
    return SetPlayerSkin(id, skin);;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)