/Pm system -
yoan103 - 24.02.2010
hi guys i need a scripter to make me a /pm command and after pm the player id's, if a player only types /pm i want it to say USAGE: /pm [playerid] [text] is this possible?
Re: /Pm system -
geerdinho8 - 24.02.2010
SCRIPT DELETED
Re: /Pm system -
aircombat - 24.02.2010
Under onplayercommandtext :
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[MAX_PLAYER_NAME+1];
new iName[MAX_PLAYER_NAME+1];
new idx;
cmd = strtok(cmdtext, idx);
Код:
//------------------------------------------------------------------------------------------------------
if(strcmp("/pm", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
SendClientMessage(playerid,YELLOW,"Usage: /pm [id] (Message)");
return 1;
}
id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage)) {
SendClientMessage(playerid,YELLOW,"Usage: /pm [id] [Message]");
return 1;
}
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,YELLOW,"Bad player ID");
return 1;
}
if(playerid != id) {
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
SendClientMessage(id,PM_INCOMING_COLOR,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
}
else {
SendClientMessage(playerid,YELLOW,"You cannot PM yourself");
}
return 1;
}
//------------------------------------------------------------------------------------------------------
________
Weed vaporizers
Re: /Pm system -
yoan103 - 24.02.2010
Код:
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(290) : error 017: undefined symbol "cmd"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(292) : error 017: undefined symbol "tmp"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(292) : error 017: undefined symbol "strtok"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(294) : error 017: undefined symbol "tmp"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(299) : error 017: undefined symbol "tmp"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(300) : error 017: undefined symbol "gMessage"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(300) : error 017: undefined symbol "strrest"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(302) : error 017: undefined symbol "gMessage"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(312) : error 017: undefined symbol "iName"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(312) : error 017: undefined symbol "iName"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(312) : error 029: invalid expression, assumed zero
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(312) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
12 Errors.
Re: /Pm system -
aircombat - 24.02.2010
told u to put that under OnPlayerCommandText :
Код:
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[MAX_PLAYER_NAME+1];
new iName[MAX_PLAYER_NAME+1];
new idx;
Bottom of script :
Код:
stock strrest(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[128];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
________
Marijuana Medical
Re: /Pm system -
yoan103 - 24.02.2010
Now i have theese
Код:
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(263) : warning 217: loose indentation
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(263) : error 017: undefined symbol "strtok"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(263) : error 033: array must be indexed (variable "cmd")
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(280) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(296) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(299) : warning 217: loose indentation
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(301) : error 017: undefined symbol "strtok"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(301) : error 033: array must be indexed (variable "tmp")
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(304) : error 017: undefined symbol "YELLOW"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(305) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(308) : error 017: undefined symbol "id"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(309) : error 017: undefined symbol "strrest"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(309) : error 033: array must be indexed (variable "gMessage")
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(312) : error 017: undefined symbol "YELLOW"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(313) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(316) : error 017: undefined symbol "id"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(317) : error 017: undefined symbol "YELLOW"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(318) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(320) : error 029: invalid expression, assumed zero
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(320) : error 017: undefined symbol "strrest"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(320) : error 029: invalid expression, assumed zero
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(320) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
20 Errors.
Re: /Pm system -
aircombat - 24.02.2010
bottom of script :
Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
if that didnt work then there must be something wrong with the script cause it works fine with me
________
Lamborghini 400Gt Monza
Re: /Pm system -
yoan103 - 24.02.2010
Код:
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[MAX_PLAYER_NAME+1];
new iName[MAX_PLAYER_NAME+1];
new idx;
if(strcmp("/pm", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
SendClientMessage(playerid,YELLOW,"Usage: /pm [id] (Message)");
return 1;
}
id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage)) {
SendClientMessage(playerid,YELLOW,"Usage: /pm [id] [Message]");
return 1;
}
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,YELLOW,"Bad player ID");
return 1;
}
if(playerid != id) {
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
SendClientMessage(id,PM_INCOMING_COLOR,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
}
else {
SendClientMessage(playerid,YELLOW,"You cannot PM yourself");
}
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
The colors have some errors but i will fix them
This is the code you wanted me to put right?
So i still get these errors
Код:
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(65) : error 017: undefined symbol "MAX_PLAYER_NAME"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(66) : error 017: undefined symbol "MAX_PLAYER_NAME"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(263) : warning 219: local variable "cmd" shadows a variable at a preceding level
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(264) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(265) : warning 219: local variable "Message" shadows a variable at a preceding level
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(266) : warning 219: local variable "gMessage" shadows a variable at a preceding level
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(267) : warning 219: local variable "pName" shadows a variable at a preceding level
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(268) : warning 219: local variable "iName" shadows a variable at a preceding level
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(269) : warning 219: local variable "idx" shadows a variable at a preceding level
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(271) : warning 217: loose indentation
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(271) : error 017: undefined symbol "strtok"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(271) : error 033: array must be indexed (variable "cmd")
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(288) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(304) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(309) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(313) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(315) : error 021: symbol already defined: "cmd"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(316) : warning 217: loose indentation
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(316) : error 021: symbol already defined: "tmp"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(317) : error 021: symbol already defined: "Message"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(318) : error 021: symbol already defined: "gMessage"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(319) : error 021: symbol already defined: "pName"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(320) : error 021: symbol already defined: "iName"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(321) : error 021: symbol already defined: "idx"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(323) : warning 217: loose indentation
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(325) : error 017: undefined symbol "strtok"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(325) : error 033: array must be indexed (variable "tmp")
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(328) : error 017: undefined symbol "YELLOW"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(329) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(332) : error 017: undefined symbol "id"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(333) : error 017: undefined symbol "strrest"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(333) : error 033: array must be indexed (variable "gMessage")
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(336) : error 017: undefined symbol "YELLOW"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(337) : error 079: inconsistent return types (array & non-array)
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(340) : error 017: undefined symbol "id"
D:\samp03asvr_R4_win32\gamemodes\Untitled.pwn(341) : error 017: undefined symbol "YELLOW"
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
26 Errors.
Please check if i have wrote the code correctly
And how do i fix the MaxPlayers problem
Re: /Pm system -
aircombat - 24.02.2010
did u even put this under OnPlayerCommandText
________
Ferrari 308 gtb specifications
Re: /Pm system -
GaGlets(R) - 24.02.2010
OMG
put that script strr.. totaly botom of pawno! and make colors total up of pawno !