public OnPlayerCommandText(playerid, cmdtext[]) if(IsPlayerConnected(playerid)) { new Float: radi, Float: str; new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) { GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); if (!strcmp(cmdtext, "/me", true, 3)) { if(!cmdtext[3])return SendClientMessage(playerid, vermelho, "Usa: /me [Aзгo]"); // Usa: /me Aзгo = [EN] Use: /me Action new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "* %s %s", str, cmdtext[4]); if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) SendClientMessage(i, roxo, "str"); } { return 0; } return 0; } }
C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(41) : warning 217: loose indentation C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(44) : warning 219: local variable "str" shadows a variable at a preceding level C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(51) : warning 217: loose indentation C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(55) : warning 225: unreachable code C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(55) : warning 217: loose indentation C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(26) : warning 203: symbol is never used: "str" C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(26 -- 61) : warning 209: function "OnPlayerCommandText" should return a value Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 7 Warnings. |
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerConnected(playerid))
{
new Float: radi, Float: str;
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (!strcmp(cmdtext, "/me", true, 3))
{
if(!cmdtext[3]) return SendClientMessage(playerid, vermelho, "Usa: /me [Aзгo]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, roxo, "str");
}
}
return 0; // no clue why you're doing this here but you're better off using "break;"
}
}
}
return 0;
}
CMD:me(playerid, params[])
{
if (isnull(params)) // Checking if params is null (params = text after the command)
return SendClientMessage(playerid, -1, "USAGE: /me [text]");
new Float:x, Float:y, Float:z, name[24], string[128];
GetPlayerPos(playerid, x, y, z);
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof (string), "* %s %s", name, params); // Just like I said before, params = text after the command
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (IsPlayerInRangeOfPoint(i, 16, x, y, z))
{
SendClientMessage(playerid, -1, string);
}
}
break;
}
return 1;
}
// Outside of any callback:
CMD:me(playerid, params[])
{
// Defining new variables; string = 144 (perfect size), text = 120 & name = 24 (MAX_PLAYER_NAME)
// Also defining the floats for GetPlayerPos which we'll use after
static string[144], text[120], name[MAX_PLAYER_NAME], Float: pX, Float: pY, Float: pZ;
GetPlayerName(playerid, name, sizeof(name));
// Defining the specifiers and params to be used, if none are used, return an error message
if(sscanf(params, "s[120]", text)) return SendClientMessage(playerid, -1, "/me [action]");
// Format the string, it'll show as "name text"
format(string, sizeof(string), "%s %s", name, text);
GetPlayerPos(playerid, pX, pY, Pz); // Getting the player's position
// Starting a loop using foreach and "i" as variable
foreach(new i: Player)
{
// If "i" is in range (6.0) of playerid's position
if(IsPlayerInRangeOfPoint(i, 6.0, pX, pY, pZ))
{
// Send the formatted message with color -1 (white)
SendClientMessage(i, -1, string);
// We don't break the loop because that would only send the message to only one player
}
}
// Return a positive value
return 1;
}
CMD:me(playerid, params[])
{
static string[144], text[120], name[MAX_PLAYER_NAME], Float: pX, Float: pY, Float: pZ;
GetPlayerName(playerid, name, sizeof(name));
if(sscanf(params, "s[120]", text)) return SendClientMessage(playerid, -1, "/me [action]");
format(string, sizeof(string), "%s %s", name, text);
GetPlayerPos(playerid, pX, pY, Pz);
foreach(new i: Player)
{
if(IsPlayerInRangeOfPoint(i, 6.0, pX, pY, pZ))
{
SendClientMessage(i, -1, string);
}
}
return 1;
}
C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(32) : error 017: undefined symbol "Pz" C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(34) : error 017: undefined symbol "foreach" C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(34) : error 029: invalid expression, assumed zero C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(34) : error 017: undefined symbol "Player" C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(34) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors. |
GetPlayerPos(playerid, pX, pY, Pz);
GetPlayerPos(playerid, pX, pY, pZ);
C:\Users\Joka\Desktop\New folder (2)\pawno\include\foreach.inc(22 ![]() |