Guys Please Help
#1

When I Type ex: /pm id text It show me usage /pm id text Not message
#if EnablePM_Cmd == true
PHP код:
CMD:pm(playerid,params[])
{
    new 
giveplayeridinputtext[256];
    if (
sscanf(params"us"giveplayeridinputtext)) return Inter_SendClientMessage(playeridCOLOR_LIGHTBLUE"Usage: /pm [PlayerID] [Message]");
    if(
giveplayerid == playerid) return
    
Inter_SendClientMessage(playeridred"ERROR: You can't send PM to yourself!");
    if(
AccInfo[playerid][NoPM] == 1//return SendClientMessage(playerid, COLOR_RED, string);
    
Inter_SendClientMessage(playeridred"User is blocked his PM!");
    if(!(
IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID)) return
    
Inter_SendClientMessage(playeridred"ERROR: Player not Connected!");
    
PMplayer1 giveplayerid;
    
GetPlayerName(giveplayeridPmReceiversizeof(PmReceiver));
    
OnPlayerPrivmsg(playeridgiveplayeridinputtext);
/*    new string[128];
    format(string,sizeof(string),"PM To: \"%s(%d)\" \n\nType the message to send:", PmReceiver, PMplayer1);
     ShowPlayerDialog(playerid,DIALOG_TYPE_PM,DIALOG_STYLE_INPUT,"PrivateMessage",string,"Send!","Cancel");*/
     
return 1;
}
#endif 
And the same wrong with this too
/pgoto id
PHP код:
CMD:pgoto(playerid,params[])
{
   new 
pteleid;
   if(
sscanf(params,"u",pteleid)) return SendClientMessage(playeridred"Usage:/pgoto [playerid]");
   if(!
IsPlayerConnected(pteleid)) return SendClientMessage(playeridred"Player is not connected");
   if(
pteleid == INVALID_PLAYER_ID) return SendClientMessage(playeridred"This isn't a valid player ID");
   if(
ptele[pteleid]==1) return SendClientMessage(playeridred"Player has not enabled ptele command");
   new 
Float:ptelex,Float:pteley,Float:ptelez,int;
   
GetPlayerPos(pteleid,ptelex,pteley,ptelez);
   
int GetPlayerInterior(pteleid);
   if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  {
   new 
vid GetPlayerVehicleID(playerid);
   
SetVehiclePos(vidptelexpteleyptelez+1);
   
LinkVehicleToInterior(vidint);
  }
    else
  {
   
SetPlayerPos(playerid,ptelex,pteley,ptelez+1);
   
SetPlayerInterior(playerid,int);
  }
   return 
1;

What should I do ?? :/
Sry For my bad Eng
Reply
#2

I'd say its the:
pawn Код:
if (sscanf(params, "us", giveplayerid, inputtext)) return Inter_SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /pm [PlayerID] [Message]");
Since you're using "us" to scan giveplayerid and inputtext, "u" is used for either a playername or id and I think that's interfering with the inputtext also being a string.

So, I'd recommend changing the "us" to "ds" and then giveplayerid will only accept playerid's, no names anymore though, but I believe this will fix your problem.
Reply
#3

for pm
Код:
if(sscanf(params,"ds[128]", giveplayerid, inputtext)) return SendClientMessage(playerid, red,"USAGE: /pm [id] [message]");
and for Goto:
Код:
if(isnull(params)) return SendClientMessage(playerid,red,"USAGE: /goto [playerid]");
Reply
#4

Try this:

PHP код:
CMD:pm(playerid,params[]) 

    new 
giveplayeridinputtext[256]; 
    if (
sscanf(params"ds"giveplayeridinputtext)) return Inter_SendClientMessage(playeridCOLOR_LIGHTBLUE"Usage: /pm [PlayerID] [Message]"); 
    if(
giveplayerid == playerid) return 
    
Inter_SendClientMessage(playeridred"ERROR: You can't send PM to yourself!"); 
    if(
AccInfo[playerid][NoPM] == 1//return SendClientMessage(playerid, COLOR_RED, string); 
    
Inter_SendClientMessage(playeridred"User is blocked his PM!"); 
    if(!(
IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID)) return 
    
Inter_SendClientMessage(playeridred"ERROR: Player not Connected!"); 
    
PMplayer1 giveplayerid
    
GetPlayerName(giveplayeridPmReceiversizeof(PmReceiver)); 
    
OnPlayerPrivmsg(playeridgiveplayeridinputtext); 
/*    new string[128]; 
    format(string,sizeof(string),"PM To: \"%s(%d)\" \n\nType the message to send:", PmReceiver, PMplayer1); 
     ShowPlayerDialog(playerid,DIALOG_TYPE_PM,DIALOG_STYLE_INPUT,"PrivateMessage",string,"Send!","Cancel");*/ 
     
return 1

#endif 
Reply
#5

Removed
Reply
#6

witch wrong?
Reply
#7

Ty SNAKE12 /pgoto fixed but /pm still the same Error :/
Reply
#8

Quote:
Originally Posted by ahmedebrahem
Посмотреть сообщение
Ty SNAKE12 /pgoto fixed but /pm still the same Error :/
I've never seen someone use "ds[128]" in the sscanf. Dont do it.
Use "ds" in there. That will work.
Reply
#9

I'm trying this and don't fixed
Reply
#10

Quote:
Originally Posted by ahmedebrahem
Посмотреть сообщение
I'm trying this and don't fixed
Thats very weird. Here, I'll give an example of how I make my /pm commands, and I have to say, its similar to yours. Yours should work if you replaced the "u" with a "d".
pawn Код:
dcmd_pm(playerid, params[])
{
    new text[256];
    new giveplayerid;
    if (sscanf(params, "ds", giveplayerid,text)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /l [text]");
    else
    {
        if(playerid != giveplayerid)
        {
            if(IsPlayerConnected(giveplayerid))
            {
                if(ToggledPM[giveplayerid] == 0)
                {
                    new string[256];
                    new name[28];
                    GetPlayerName(playerid, name, 28);
                    format(string, sizeof(string), "PM from %s(%d): %s", name, playerid,text);
                    SendClientMessage(giveplayerid, YELLOW, string);
                    print(string);
                    GetPlayerName(giveplayerid, name, 28);
                    format(string, sizeof(string), "PM sent to %s(%d): %s", name, giveplayerid,text);
                    SendClientMessage(giveplayerid, YELLOW, string);
                    print(string);
                    return 1;
                }
                else return SendClientMessage(playerid, RED, "[Error] Player's PM toggled");
            }
            else return SendClientMessage(playerid, RED, "[Error] Playerid not connected");
        }
        else return SendClientMessage(playerid, RED, "[Error] You cannot pm yourself.");
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)