Heeelp with this commands
#1

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;
}
Reply
#2

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.
Reply
#3

Please i need help there...
Reply
#4

There is already a function called SetPlayerWantedLevel(); You can't use that again. You should change the name of the function.

PHP код:
stock SetPlayerWanted(playeridlevel)
{
   switch(
level)
   {
        case 
0SetPlayerColor(playeridCOLOR_WHITE);
        case 
1SetPlayerColor(playeridCOLOR_YELLOW);
        case 
2SetPlayerColor(playeridCOLOR_YELLOW);
        case 
3SetPlayerColor(playeridCOLOR_ORANGE);
        case 
4SetPlayerColor(playeridCOLOR_DARKORANGE);
        case 
5SetPlayerColor(playeridCOLOR_RED);
        case 
6SetPlayerColor(playeridCOLOR_RED);
    }
   return 
SetPlayerWantedLevel(playeridlevel);

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

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

PHP код:
CMD:do(playeridparams[])
{
    new 
text[128], str[128];
    if(
sscanf(params"s[128]"text)) return SendClientMessage(playerid0xFF0000FF"Usage: /do [text]");
    
format(strsizeof(str), "* %s (( %s )) *",  GetName(playerid), text);
    
SendClientMessageToAll(COLOR_ORANGEstr);
    return 
1;

Reply
#5

This line in /pm should be
PHP код:
format(Stringsizeof(String), "%s [%d] is no more accepting private messages!"GetName(ID), ID); 
And you missed the ID specifier in both your PM messages.

PHP код:
format(String2sizeof(String2), "[PM]: To %s(%d): %s"PlayerName(ID), ID,Message);
   
SendClientMessage(playeridCOLOR_YELLOWString2);
   
format(String2sizeof(String2), "[PM]: From %s[%d]: %s"PlayerName(playerid), playerid,Message);
   
SendClientMessage(IDCOLOR_YELLOWString2); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)