if(strcmp(cmd, "/report", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[96];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [text]");
format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result));
ABroadCast(COLOR_LIGHTYELLOW,string,1);
SendClientMessage(playerid, COLOR_YELLOW, "Your report message was sent to online administrators, thank you.");
}
return 1;
}
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(307) : error 017: undefined symbol "cmd" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : error 017: undefined symbol "sendername" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : error 017: undefined symbol "sendername" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : error 029: invalid expression, assumed zero D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : fatal error 107: too many error messages on one line
filterscripts baseaf
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mycommand", cmdtext, true, 10) == 0) { // do something here return 1; } if(strcmp("/report", cmdtext,true, 10) == 0) { if(IsPlayerConnected(playerid)) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[96]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [text]"); format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result)); ABroadCast(COLOR_LIGHTYELLOW,string,1); SendClientMessage(playerid, COLOR_YELLOW, "Your report message was sent to online administrators, thank you."); } return 1; } return 0; }
public OnPlayerCommandText(playerid, cmdtext[])
{
new sendername[MAX_PLAYER_NAME];
new cmd[128];
cmd = strtok(cmdtext, idx);
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// do something here
return 1;
}
if(strcmp("/report", cmdtext,true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[96];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [text]");
format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result));
ABroadCast(COLOR_LIGHTYELLOW,string,1);
SendClientMessage(playerid, COLOR_YELLOW, "Your report message was sent to online administrators, thank you.");
}
return 1;
}
return 0;
}
...to make an admin system that i can kick someone out of the room and things like that but only available when you play with the Rcon password. |
Add this at OnPlayerCommandText:
new sendername[MAX_PLAYER_NAME]; new cmd[128]; cmd = strtok(cmdtext, idx); |
stock pName( playerid ) {
new b[ 24 ];
return GetPlayerName( playerid, b, 24 ), b;
}
COMMAND:report( playerid, params[ ] )
{
new
userid,
reason[ 64 ]
;
if ( sscanf( params, "us[64]", userid, reason ) )
return SendClientMessage( playerid, -1, "{FFDD00}/Report < PartOfName/ID > < Reason >" );
if ( userid == playerid )
return SendClientMessage( playerid, -1, "{FFDD00}You cannot report yourself." );
if ( userid == INVALID_PLAYER_ID )
return SendClientMessage( playerid, -1, "{FFDD00}Invalid player." );
SendClientMessage( playerid, -1, "{FFDD00}Report has been sent to the online RCON administrators." );
for ( new j = GetMaxPlayers( ), i; i < j; i ++ )
{
if ( !IsPlayerConnected( i ) )
continue;
if ( IsPlayerAdmin( i ) )
{
new
szReportString[ 128 ]
;
format( szReportString, sizeof szReportString, "Report from %s: %s(%d) = %s.",
pName( playerid ), pName( userid ), userid, reason );
SendClientMessage( i, 0xAA0000AA, szReportString );
}
}
return 1;
}
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(309) : error 017: undefined symbol "strtok" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(309) : error 033: array must be indexed (variable "cmd") D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(310) : warning 217: loose indentation D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(321) : error 017: undefined symbol "idx" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(323) : error 017: undefined symbol "idx" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(323) : warning 215: expression has no effect D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(325) : error 017: undefined symbol "idx" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(327) : error 017: undefined symbol "idx" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(329) : error 017: undefined symbol "idx" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(330) : error 017: undefined symbol "idx" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(330) : warning 215: expression has no effect D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(332) : error 017: undefined symbol "idx" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : error 017: undefined symbol "string" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : error 017: undefined symbol "string" D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : error 029: invalid expression, assumed zero D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : fatal error 107: too many error messages on one line