Very new to scripting please don't be too mean xD
#1

How do I send a message to the playerid saying "You have set _____'s skin to ___." in this cmd?

PHP код:
CMD:setskin(playeridparams[])
{
    new 
targetidskinid;
    if(
sscanf(params"ii"targetidskinid)) 
    return 
SendClientMessage(playerid, -1"[USAGE]: /setskin [playerid] [skinid]");
    
SetPlayerSkin(targetidskinid);
    
SendClientMessage(playerid, -1"You have set %s's skin id to %i."); //this is the line i need help with
    
return 1;

Reply
#2

pawn Код:
CMD:setskin(playerid, params[])
{
    new targetid, skinid, str[90], name[MAX_PLAYER_NAME];
    if(sscanf(params, "ii", targetid, skinid))  
    return SendClientMessage(playerid, -1, "[USAGE]: /setskin [playerid] [skinid]");
    SetPlayerSkin(targetid, skinid);
    GetPlayerName(targetid, name, sizeof(name));
    format(str, sizeof(str), "You have set %s's skin id to %i.",name, skinid);
    SendClientMessage(playerid, -1, str);
    return 1;
}
SendClientMessage has only 3 paramaters, use format for those.
Reply
#3

tyvm, +rep
Reply
#4

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Hopefully this was helpful and you'll think more about readability as you continue to improve your programming skills!
Thank you very much! I was actually thinking about this yesterday when I was posting in this section for help, I was like... these people are definitely pissed off at how hideously compact all this code is. lmaoo

Thank you appreciate it!
Reply
#5

Also:

Код:
if(sscanf(params, "ii", targetid, skinid))
use the parameter "u" instead of "i" so you can choose either the target's name or his ID, using "i" will trigger IDs only.

Код:
if(sscanf(params, "ui", targetid, skinid))
Reply
#6

For help with parameters for functions please do refer to the wiki since it will save you and us time, link for the wiki: https://sampwiki.blast.hk/

Link for SendClientMessage function: https://sampwiki.blast.hk/wiki/SendClientMessage

Link for format function: https://sampwiki.blast.hk/wiki/format

Link for all functions: https://sampwiki.blast.hk/wiki/Category...ting_Functions
Link for all callbacks: https://sampwiki.blast.hk/wiki/Category...ting_Callbacks
Reply
#7

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
Also:

Код:
if(sscanf(params, "ii", targetid, skinid))
use the parameter "u" instead of "i" so you can choose either the target's name or his ID, using "i" will trigger IDs only.

Код:
if(sscanf(params, "ui", targetid, skinid))
Thank you very much!

I was wondering how I could do this. Appreciate it. I'll try and remember to rep you tomorrow, cant give out anymore rep today lmao
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)