Need answers / /skin
#1

Can someone make a command /skin for me, And please don't think I am too lazy to make it myself , No it's not that.
Please make it for me,

and please answer this questions for me: 1.What does "SYNTAX" mean, other word for "USAGE"?
- 2.What does sizeof mean?
- 3.What does return -1 mean?
Weird questions , I know but please answer them.
Reply
#2

What would you want the command to do?

Syntax: http://dictionary.reference.com/browse/syntax
In reference to commands, people just use it for another word of usage.

Sizeof: https://sampwiki.blast.hk/wiki/Keywords:Operators#sizeof
Returns the size in ELEMENTS of an array

-1: When using it with SendClientMessage, it's just white. I'm unsure how to explain it when using it in other terms.
Reply
#3

thanks for answers, the /skin cmd , Just when someone does /skin 23 it goes to skin 23.
Don't think I am lazy, please, For you I try to script it REMEMBER I AM BAD(I DO WHAT I THINK IT IS TILL SO FAR) and you add/improve the cmd.
AND JUST ADMINS CAN USE THAT COMMAND

Quote:

CMD: skin(playerid, params[])
{
new(string, sizeof[45])
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
else if (IsPlayerAdmin(playerid))
SetPlayerSkin(playerid, [45]);
{
return 1;
}

I know its wrong but can you improve it, I just did this to show that I am not lazy to do it, but it's just I don't know how to make it.
Reply
#4

Can someone improve it?
Reply
#5

What are you admin variables? Or do you want it to work via /rcon login
Reply
#6

Actually I want it via admin things, but since I don't know how to script that, I currently use it via /rcon,
Can you help me?
Reply
#7

Does this help you?
Код:
CMD:setskin(playerid, params[])
{
    new id, ammount, name[MAX_PLAYER_NAME], string[128];
    if(!(PlayerInfo[playerid][pAdmin] >= 4)) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command");
    else if(sscanf(params,"ui", id, ammount)) return SendClientMessage(playerid, COLOR_GREY,"[True:RP]: /setskin [playerid/partofname] [skinmodel]");
    else if(ammount > 299 || ammount < 1) return SendClientMessage(playerid, COLOR_GREY,"Wrong Skin ID! Available ID's: 1-299");
    else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
    else
    {
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string),"Your skin have been set to %i by admin %s", ammount, name);
    SendClientMessage(id, COLOR_GREEN, string);
    PlayerInfo[id][pSkin] = ammount;
    SetPlayerSkin(id, PlayerInfo[id][pSkin]);
    }
    return 1;
}
Reply
#8

I have not tested this but it should work

Код:
CMD:setskin(playerid, params[])
{
	new playerb, skin, string[128];
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an RCON Admin!"); 
	if(sscanf(params, "ui", playerb, skin)) return SendClientMessage(playerid, COLOR_WHITE, "[USE]: /setskin [playerid] [skinid]"); 
	if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
	if(skin < 0 || skin > 299) return SendClientMessage(playerid, COLOR_GREY, "Skins are between 0 and 299.");
	SetPlayerSkin(playerb, skin);
	format(string, sizeof(string), " You have set %s's skin to ID %d.", RPN(playerb), skin);
	SendClientMessage(playerid, COLOR_WHITE, string);
	format(string, sizeof(string), " Administrator %s has set your skin to ID %d.", RPN(playerid), skin);
	SendClientMessage(playerb, COLOR_WHITE, string);
	return 1;
}
Reply
#9

gychem,, YOUR SCRIPT GIVE THESE ERRORS:
Quote:

C:\Users\selma\Desktop\Samp\gamemodes\Lerenscripte n.pwn(539) : error 017: undefined symbol "IsPlayerLoggedIn"
C:\Users\selma\Desktop\Samp\gamemodes\Lerenscripte n.pwn(542) : error 017: undefined symbol "RPN"
C:\Users\selma\Desktop\Samp\gamemodes\Lerenscripte n.pwn(544) : error 017: undefined symbol "RPN"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Reply
#10

Since nobody answered you what return means:

Formally
Quote:

A return statement is a jump statement. It transfers control unconditionally to the end point of the call site in the stack frame. Returns either specify a value or expression, or are void.

Simplified, it's a control structure that makes the function give back a value when it's called. If you have a function that always returns 1, and use the function to assign a value to a variable, it will be assigned 1 as the function returned that value. You can specify the function to return any value, or even variables, and even strings (conditioned)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)