SA-MP Forums Archive
Heeelp with this commands - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Heeelp with this commands (/showthread.php?tid=632686)



Heeelp with this commands - Man43 - 17.04.2017

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;
}



Re: Heeelp with this commands - Vince - 17.04.2017

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.


Re: Heeelp with this commands - Man43 - 17.04.2017

Please i need help there...


Re: Heeelp with this commands - DarkSkull - 17.04.2017

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;




Re: Heeelp with this commands - DarkSkull - 17.04.2017

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);