09.08.2010, 17:38
Whats the problem with this /pm command?
09.08.2010, 17:39
Try this: http://pastebin.com/SXq7qEgK
09.08.2010, 17:39
pawn Код:
dcmd_pm(playerid,params[])
{
new target, string[128],string2[128], message,pname{MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
if(sscanf(params,"us",target, message)) return SendClientMessage(playerid,red,"USAGE: /pm [Name / ID] [Message]");
if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Invalid Name / ID");
GetPlayerName(target,pname,sizeof(pname);
GetPlayerName(playerid,bname,sizeof(bname);
format(string,sizeof(string),"* From %s(%d) - PM: %s",bname,playerid,message);
SendClientMessage(target,YELLOW,string);
format(string2,sizeof(string2),"* To %s(%d) - PM: %s",pname,target,message);
SendClientMessage(playerid,YELLOW,string2);
return true;
}
wow hiddos beat me
mine will work. you guys didnt put your sscanf right
09.08.2010, 19:46
I really dont want a new command. I just wanna know what I did wrong.
09.08.2010, 19:51
you misses sscanf you needed "us" or "is"
s for string aka the message u for userand playerid
i for playerid only
so here in the message
if(sscanf(params,"i",pid,message))
notice you only put I that would call pid only so change that to us or is
happy coding
s for string aka the message u for userand playerid
i for playerid only
so here in the message
if(sscanf(params,"i",pid,message))
notice you only put I that would call pid only so change that to us or is
happy coding
09.08.2010, 19:52
pawn Код:
if(sscanf(params,"i",pid,message)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /pm [playerid] [message]");
pawn Код:
if(sscanf(params,"us",pid,message)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /pm [playerid] [message]");
edit; wtf u beat me? D:
09.08.2010, 19:54
Sorry I PWN.
- Kar, Happy Scripting
- Kar, Happy Scripting
09.08.2010, 20:06
I kind saw it after.. Thanks
Edit:
When I /pm someone, I only get: There is no player online with that id. What is wrong now?
Edit:
pawn Код:
dcmd_pm(playerid, params[])
{
new pid,message;
if(sscanf(params,"us",pid,message)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /pm [playerid] [message]");
else if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOUR_BROWN, "There is no player online with that id");
{
new string[128],string2[128],name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(pid,name2,sizeof(name2));
format(string,sizeof(string),"PM sent to %s: %s",name2,message);
SendClientMessage(playerid,COLOUR_ORANGE,string2);
format(string,sizeof(string),"PM from %s: %s",name,message);
SendClientMessage(pid,COLOUR_ORANGE,string);
return 1;
}
}
When I /pm someone, I only get: There is no player online with that id. What is wrong now?
09.08.2010, 21:25
remove the else and the { and 1 } at the end...
edit; *sigh*
should do the trick
edit; *sigh*
pawn Код:
dcmd_pm(playerid, params[])
{
new pid,message;
if(sscanf(params,"us",pid,message)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /pm [playerid] [message]");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOUR_BROWN, "There is no player online with that id");
new string[128],string2[128],name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(pid,name2,sizeof(name2));
format(string,sizeof(string),"PM sent to %s: %s",name2,message);
SendClientMessage(playerid,COLOUR_ORANGE,string2);
format(string,sizeof(string),"PM from %s: %s",name,message);
SendClientMessage(pid,COLOUR_ORANGE,string);
return 1;
}
10.08.2010, 11:09
I got Unknown Command when I tried to pm.
Oh wait, tried yours.. I got: There is no player online with that id
Oh wait, tried yours.. I got: There is no player online with that id
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)