PDA

View Full Version : Heeelp with this commands


Man43
17/04/2017, 07:21 PM
Hello im making players colors but not worked.. how to i can fix it?

stock SetPlayerWantedLevel(playerid, level)
{
switch(level)
{
case 0: SetPlayerColor(playerid, COLOR_WHITE);
case 1: SetPlayerColor(playerid, COLOR_YELLOW);
case 2: SetPlayerColor(playerid, COLOR_YELLOW);
case 3: SetPlayerColor(playerid, COLOR_ORANGE);
case 4: SetPlayerColor(playerid, COLOR_DARKORANGE);
case 5: SetPlayerColor(playerid, COLOR_RED);
case 6: SetPlayerColor(playerid, COLOR_RED);
}
return SetPlayerWantedLevel(playerid, level);
}

Here >> For /do + /pm i want fix it.

Here no bugs but When i type /do i got >> My Message ((And Here my name)) so i want fix it.... i want My Name (( Here Message ))
CMD:do(playerid, params[])
{
new text[128], str[128];
if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /do [text]");
format(str, sizeof(str), "* %s (( %s )) *", text, GetName(playerid));
SendClientMessageToAll(COLOR_ORANGE, str);
return 1;
}

Here /pm i trying to fix it but still not work... im typing /pm 0 TesT i got random number [ID] Please help

CMD:pm(playerid, parmas[])
{
new ID,
Message[256],
String[256],
String2[256];
if(sscanf(parmas, "us[256]", ID, Message)) return SendClientMessage(playerid, COLOR_RED, "Usage: /pm [id] [message]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Player not connected!");
if(ID == playerid) return SendClientMessage(playerid, COLOR_RED, "You can not PM yourself!");
if(PlayerInfo[ID][Block] == playerid) return SendClientMessage(playerid, COLOR_RED, "The player has chosen not recieve Pms from you!");
format(String, sizeof(String), "%s [%d] is no more accepting private messages!");
if(PlayerInfo[ID][PmOff] == 1) return SendClientMessage(playerid, COLOR_YELLOW, String);
if(PlayerInfo[playerid][PmOff] == 1) return SendClientMessage(playerid, COLOR_RED,"You can not send private message when you have switched off your pms!");
format(String2, sizeof(String2), "[PM]: To %s(%d): %s", PlayerName(ID), Message);
SendClientMessage(playerid, COLOR_YELLOW, String2);
format(String2, sizeof(String2), "[PM]: From %s[%d]: %s", PlayerName(playerid), Message);
SendClientMessage(ID, COLOR_YELLOW, String2);
PlayerInfo[ID][Lastpm] = playerid;
return 1;
}

Vince
17/04/2017, 07:27 PM
You can't have a function with the same name as a native function. If you want to hook it then look up the ALS hooking method.

Man43
17/04/2017, 07:31 PM
Please i need help there...

DarkSkull
17/04/2017, 07:50 PM
There is already a function called SetPlayerWantedLevel(); You can't use that again. You should change the name of the function.

stock SetPlayerWanted(playerid, level)
{
switch(level)
{
case 0: SetPlayerColor(playerid, COLOR_WHITE);
case 1: SetPlayerColor(playerid, COLOR_YELLOW);
case 2: SetPlayerColor(playerid, COLOR_YELLOW);
case 3: SetPlayerColor(playerid, COLOR_ORANGE);
case 4: SetPlayerColor(playerid, COLOR_DARKORANGE);
case 5: SetPlayerColor(playerid, COLOR_RED);
case 6: SetPlayerColor(playerid, COLOR_RED);
}
return SetPlayerWantedLevel(playerid, level);
}

I've changed it to SetPlayerWanted(); Use this instead.

For /do command, You have the message and name mixed up! This should fix it.

CMD:do(playerid, params[])
{
new text[128], str[128];
if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /do [text]");
format(str, sizeof(str), "* %s (( %s )) *", GetName(playerid), text);
SendClientMessageToAll(COLOR_ORANGE, str);
return 1;
}

DarkSkull
17/04/2017, 08:39 PM
This line in /pm should be
format(String, sizeof(String), "%s [%d] is no more accepting private messages!", GetName(ID), ID);

And you missed the ID specifier in both your PM messages.

format(String2, sizeof(String2), "[PM]: To %s(%d): %s", PlayerName(ID), ID,Message);
SendClientMessage(playerid, COLOR_YELLOW, String2);
format(String2, sizeof(String2), "[PM]: From %s[%d]: %s", PlayerName(playerid), playerid,Message);
SendClientMessage(ID, COLOR_YELLOW, String2);