Hi I Need Help In This Command
#1

The Problem Is :
1-The Messages Even Warning 1 Or Warning 2 Or Warning 3 Doesn't Appear

================================================== ======
Helping With :
1-Long String
2-Long Reason

===========
Information : I Had Searched A Lot Then I Got This Command So Please :
1-Don't Give Me Links (Because I Read The Most Poplular Tutorials)
2-Don't Change Messages
3-And Test It To Find What's The Problem
4-Give Me Your Work But With Full My Code

================================
Please And Thanks
==============

Code :

Quote:

CMD:warn(playerid, params[])
{
new AdminName[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], id, string[1000], Warnings[MAX_PLAYERS], Reason[100];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Only Admins Can Be Use This Command [ ! ]");
if(sscanf(params, "us", id, Reason)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /warn [Player-ID] [Reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Invalid-Player-ID [ ! ]");
if(id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You Can't Warn Your Self [ ! ]");
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
If(Warnings[playerid] == 1)
{
format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : 1/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason);
SendClientMessageToAll(playerid, string);
}
If(Warnings[playerid] == 2)
{
format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : 2/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason);
SendClientMessageToAll(playerid, string);
}
If(Warnings[playerid] == 3)
{
format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Kicked {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : 3/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason);
SendClientMessageToAll(playerid, strin);
Kick(id);
}
for(new pid = 0; pid < MAX_PLAYERS; pid++)
{
PlayerPlaySound(pid, 1057, 0.0, 0.0, 0.0);
}
return 1;
}

Reply
#2

As far as I know you're doing it wrong, make it when an admin warnings a player, a variable will increase ++ means if its 0 it'll increase to 1 if 1 it'll increase to 2, if 2 increase to 3, and so on, you're not increasing it at all so how would you think it'll show the messages? hope you got it.
Reply
#3

The warning messages are not shown because you used:
pawn Код:
Warnings[playerid]
it must be:
pawn Код:
Warnings[id]
The messages without the 2 names and the reason is 139 characters I think and it won't show more than 144 characters.

Reduce the spacing and remove the colors so it can fit the whole message.

Checking if each warning is 1/2/3 is pointless. Just use one message and pass:
pawn Код:
Warnings[id]
As argument so it would be: "%d/3"
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The warning messages are not shown because you used:
pawn Код:
Warnings[playerid]
it must be:
pawn Код:
Warnings[id]
The messages without the 2 names and the reason is 139 characters I think and it won't show more than 144 characters.

Reduce the spacing and remove the colors so it can fit the whole message.

Checking if each warning is 1/2/3 is pointless. Just use one message and pass:
pawn Код:
Warnings[id]
As argument so it would be: "%d/3"
So if he use [playerid] then the target player that will show the message is the one who use the command? a'm I right?
Reply
#5

Quote:
Originally Posted by enzo27
Посмотреть сообщение
So if he use [playerid] then the target player that will show the message is the one who use the command? a'm I right?
The playerid is the one who typed the command (who has 0 warnings) and that's why the message is never shown.
Reply
#6

Ok Thanks All I Will Change The Code Because When I Write It I Was Don't Have Zcmd & Sscanf2 I Typed It From (IPhone) So It Must Be Somthing Like This :

Quote:

CMD:warn(playerid, params[])
{
new AdminName[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], id, string[1000], Warnings[MAX_PLAYERS], Reason[100];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Only Admins Can Be Use This Command [ ! ]");
if(sscanf(params, "us", id, Reason)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /awarn [Player-ID] [Reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Invalid-Player-ID [ ! ]");
if(id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You Can't Warn Your Self [ ! ]");
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
if(Warnings[id] == 1)
{
format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : %d/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason);
SendClientMessageToAll(playerid, string);
}
if(Warnings[id] == 2)
{
format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : %d/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason);
SendClientMessageToAll(playerid, string);
}
if(Warnings[id] == 3)
{
format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Kicked {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : %d/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason);
SendClientMessageToAll(playerid, string);
Kick(id);
}
for(new pid = 0; pid < MAX_PLAYERS; pid++)
{
PlayerPlaySound(pid, 1057, 0.0, 0.0, 0.0);
}
return 1;
}

Reply
#7

Else ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)