#1

It does not set frank's skin to 237

Код:
CMD:frankslave(playerid, params[])
{
	new Online;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(strcmp(GetName(i), "Frank", true))
			{
				On‌line = 1;
				SetPlayerSkin(i, 237);
			}
			else { On‌line = 0; }
		}
	}

    if(!strcmp(GetName(playerid), "Tony_Storm"))
    {
		if(Online == 1) return GameTextForPlayer(playerid, "Frank is not online", 4000, 3);
        SendClientMessageToAll(COLOR_RED, "-----------------------------------------");
        SendClientMessageToAll(COLOR_RED, "Frank Is a slave now (Owner: Tony_Storm)");
        SendClientMessageToAll(COLOR_RED, "----------------------------------------");
        SetPlayerSkin(playerid, 147);
    }
    return 1;
}
Reply
#2

I believe you should add this so the server gets the player name.
Код:
GetPlayerName(i, Online, MAX_PLAYER_NAME);
Reply
#3

I use the online variable to check if the player named frank is online or not and the GetName(); function is a short form of GetPlayerName which returns player name (From k_functions.inc)
Reply
#4

Quote:

Return Values:
0 if strings match each other on given length;
1 o r -1 if some character do not match: string1[i] - string2[i] ('i' represents character index starting from 0);
difference in number of characters if one string matches only part of another string.

From the Strcmp page on the SA-MP Wiki.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)