public OnPlayerCommandText(playerid,cmdtext[]) { new string[128],cmd[32],pos=strfind(cmdtext," "); strmid(cmd,cmdtext,0,(pos == -1)?strlen(cmdtext):pos); format(string,128,"* %s used %s",GetName(playerid),cmd); SendClientMessageToAll(-1,string); } stock GetName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,MAX_PLAYER_NAME); return name; }
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(323) : error 021: symbol already defined: "cmd"
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(330) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(338) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(346) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(354) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(362) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(370) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(319) : warning 204: symbol is assigned a value that is never used: "tmp"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[128]; //319
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
new string[128],cmd[32],pos=strfind(cmdtext," "); //323
strmid(cmd,cmdtext,0,(pos == -1)?strlen(cmdtext):pos);
format(string,128,"* %s used %s",GetName(playerid),cmd);
SendClientMessageToAll(-1,string);
if(!strcmp("/aslm", cmdtext, true))
{
new name[128],string[128]; //330
GetPlayerName(playerid,name,128);
format(string, sizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Assalamualaikum{FF00EA}' {FFAF00}!",name);
SendClientMessageToAll(0xAFAFAFAA, string);
return 1;
}
if(!strcmp("/wslm", cmdtext, true))
{
new name[128],string[128]; //338
GetPlayerName(playerid,name,128);
format(string, sizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Waalaikumussalam{FF00EA}' {FFAF00}!",name);
SendClientMessageToAll(0xAFAFAFAA, string);
return 1;
}
if(!strcmp("/ty", cmdtext, true))
{
new name[128],string[128]; //346
GetPlayerName(playerid,name,128);
format(string, sizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Thank You!{FF00EA}' {FFAF00}!",name);
SendClientMessageToAll(0xAFAFAFAA, string);
return 1;
}
if(!strcmp("/wc", cmdtext, true))
{
new name[128],string[128]; //354
GetPlayerName(playerid,name,128);
format(string, sizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}You're Welcome!{FF00EA}' {FFAF00}!",name);
SendClientMessageToAll(0xAFAFAFAA, string);
return 1;
}
if(!strcmp("/wb", cmdtext, true))
{
new name[128],string[128]; //362
GetPlayerName(playerid,name,128);
format(string, sizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Welcome Back!{FF00EA}' {FFAF00}!",name);
SendClientMessageToAll(0xAFAFAFAA, string);
return 1;
}
if(!strcmp("/bye", cmdtext, true))
{
new name[128],string[128]; //370
GetPlayerName(playerid,name,128);
format(string, sizeof(string), "{00C0FF}%s {FF00EA}' {F81414}Bye!!{FF00EA}' {FFAF00}!",name);
SendClientMessageToAll(0xAFAFAFAA, string);
return 1;
}
if (strcmp("/cmds", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "BCR Command List", "Player Commands\nText Commands\nTeleport Commands\nVIP Level 1 Commands\nVIP Level 2 Commands\nVIP Level 3 Commands\nServer Info", "Select", "Exit");
return 1;
}
if(strcmp(cmdtext, "/afk", true) == 0)
{
SendClientMessage(playerid, 0xAFAFAFAA,"<<< You are now afk ( Away from Keyboard ), type /back to move again >>>");
TogglePlayerControllable(playerid,0);
new string1[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string1,sizeof(string1), "<<< %s is now afk ( Away from Keyboard ) >>>", name);
SendClientMessageToAll(Blue, string1);
return 1;
}
if (strcmp("/rules", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Hack\n- No Spamming\n- No Cheating\n Allowed Cheat:Surfly,Repair Car,Flip\n- Respect Admins\n\nDo you agree to these rules?", "Yes", "No");
return 1;
}
if(!strcmp(cmdtext, "/me", true, 3))
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xAFAFAFAA, "[Server Message]: /me [action]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s *", str, cmdtext[4]);
SendClientMessageToAll(0xA8A8FFAA, str);
return 1;
}
if(strcmp(cmd, "/kill", true) == 0)
{
SetPlayerHealth(playerid, 0);
SpawnPlayer(playerid);
return 1;
}
if(strcmp(cmdtext, "/back", true) == 0)
{
SendClientMessage(playerid, 0xAFAFAFAA,"<<< You are no longer afk ( Away from Keyboard ) >>>");
TogglePlayerControllable(playerid, 1);
new string1[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string1,sizeof(string1), "<<< %s is no longer afk ( Away from Keyboard ) >>>", name);
SendClientMessageToAll(Blue, string1);
return 1;
}
if (strcmp("/stream", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "Music Streamer Ver.2.0","Stream For Self\nStream For Other Player (V.I.P Only)", "Select", "Cancel");
return 1;
}
if (strcmp("/chatcolour", cmdtext, true) == 0 || strcmp("/ccol", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid,20,DIALOG_STYLE_LIST,"{FFCC00}Choose the colour for your name.","{33CC00}Green\r\n{FF0000}Red\r\n{FFCC00}Orange\n{CC66CC}Purple\n{FFFFFF}White\n{000000}Black\n{3333FF}Blue","Okay", "Not okay");
return 1;
}
if (strcmp("/dragtrack", cmdtext, true, 10) == 0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1007.5, 2425.0, 10.6);
return 1;
}
if (strcmp(cmdtext, "/arch", true) == 0)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), -2704.4775,217.2848,3.8375);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 90);
}
else
{
SetPlayerPos(playerid, -2714.2739,204.8123,4.3281);
SetPlayerFacingAngle(playerid, 0);
}
SetCameraBehindPlayer(playerid);
return 1;
}
if (strcmp(cmdtext, "/trans", true) == 0)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), -1936.360839, 225.120300, 33.814777);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 357.421691);
}
else
{
SetPlayerPos(playerid, -1936.360839, 225.120300, 33.814777);
SetPlayerFacingAngle(playerid, 357.421691);
}
SetCameraBehindPlayer(playerid);
return 1;
}
if (strcmp("/about", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 645, DIALOG_STYLE_LIST, "BCR Server Info", "Gamemode Name:BCR GM V2.0\nGamemode Version:V2\nOwner:Aiman Zack\nCo-Owner:Sahrul012,Firdaus\nAdmins:\nVIPs:\nBest Player:", "Exit", "");
return 1;
}
if (strcmp("/fstyle", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 206, DIALOG_STYLE_LIST, "Fighting Styles", "Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal", "Select", "Cancel");
return 1;
}
if (strcmp("/shh", cmdtext, true, 10) == 0)
{
StopAudioStreamForPlayer(playerid);
return 1;
}
if (strcmp("/teleport", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 400, DIALOG_STYLE_LIST, "Teleport Categories", "Los Santos\nSan Fierro\nLas Venturas\nOther", "Select", "Cancel");
return 1;
}
return 0;
}
//---------//
format(tmp,128,"* %s used %s",GetName(playerid),cmd); SendClientMessageToAll(-1,tmp);
Ok, when you post it there, just write it like this:
Код:
format(tmp,128,"* %s used %s",GetName(playerid),cmd); SendClientMessageToAll(-1,tmp); |
new tmp[128]; //319
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);