09.04.2011, 22:50
I want a /me and a /do command. Only players in range of 5 or 10 meters can see it.
{
if(strcmp(cmdtext, "/me", true, 3)==0) {
new pname1[24], string[256];
GetPlayerName(playerid, pname1, 24);
format(string, 256, "*%s (%d) %s", pname1, playerid, cmdtext[4]);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 1;
}
if(strcmp(cmd, "/do", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /do [local chat]");
return 1;
}
if(PlayerInfo[playerid][pMask] == 1)
{
format(string, sizeof(string), "* %s (( Stranger ))", result);
}
else
{
format(string, sizeof(string), "* %s (( %s ))",result , sendername);
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
return 1;
#define DO_RANGE 300
command(me, playerid, params[])
{
new string[128];
if(strlen(params) < 5) return SendClientMessage(playerid, 0x0, "Your action has to contain at least 5 chars.");
format(string, sizeof(string), "( ( %s [ %d ] ) : %s )", GetName(playerid), playerid, params);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 1;
}
command(do, playerid, params[])
{
new string[128], Float: Pos[3];
if(strlen(params) < 5) return SendClientMessage(playerid, 0x0, "Your action has to contain at least 5 chars.");
format(string, sizeof(string), "( ( %s [ %d ] ) : %s )", GetName(playerid), playerid, params);
for(new i; i < MAX_PLAYERS; i++)
{
if(i != playerid && IsPlayerConnected(i) && IsPlayerInRange(i, DO_RANGE, DO_RANGE, Pos[0], Pos[1], Pos[2]))
{
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
SendClientMessage(playerid, GetPlayerColor(playerid), string);
return 1;
}
stock GetName(playerid)
{
new pName[25];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
stock IsPlayerInRange(playerid, Float:Range, Float:Z_Range, Float:tar_x, Float:tar_y, Float:tar_z) //By Gabriel "Larcius" Cordes
{
new bool:care_z = true, Float:player_x, Float:player_y, Float:player_z, Float:radius_xy, Float:radius_z;
GetPlayerPos(playerid, player_x, player_y, player_z);
radius_xy = floatsqroot(floatadd(floatpower(floatsub(player_x,tar_x),2.0),floatpower(floatsub(player_y,tar_y),2.0)));
radius_z = floatsqroot(floatadd(floatpower(radius_xy,2.0),floatpower(floatsub(player_z,tar_z),2.0)));
if(radius_z > Z_Range && radius_xy < radius_z)
{
care_z = false;
}
if(radius_xy <= Range && care_z)
{
return 1;
}
return 0;
}
#define DO_RANGE 300
command(me, playerid, params[])
{
new string[128];
if(strlen(params) < 5) return SendClientMessage(playerid, 0x0, "Your action has to contain at least 5 chars.");
format(string, sizeof(string), "( ( %s [ %d ] ) : %s )", GetName(playerid), playerid, params);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 1;
}
command(do, playerid, params[])
{
new string[128], Float: Pos[3];
if(strlen(params) < 5) return SendClientMessage(playerid, 0x0, "Your action has to contain at least 5 chars.");
format(string, sizeof(string), "( ( %s [ %d ] ) : %s )", GetName(playerid), playerid, params);
for(new i; i < MAX_PLAYERS; i++)
{
if(i != playerid && IsPlayerConnected(i) && IsPlayerInRange(i, DO_RANGE, DO_RANGE, Pos[0], Pos[1], Pos[2]))
{
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
SendClientMessage(playerid, GetPlayerColor(playerid), string);
return 1;
}
stock GetName(playerid)
{
new pName[25];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
stock IsPlayerInRange(playerid, Float:Range, Float:Z_Range, Float:tar_x, Float:tar_y, Float:tar_z) //By Gabriel "Larcius" Cordes
{
new bool:care_z = true, Float:player_x, Float:player_y, Float:player_z, Float:radius_xy, Float:radius_z;
GetPlayerPos(playerid, player_x, player_y, player_z);
radius_xy = floatsqroot(floatadd(floatpower(floatsub(player_x,tar_x),2.0),floatpower(floatsub(player_y,tar_y),2.0)));
radius_z = floatsqroot(floatadd(floatpower(radius_xy,2.0),floatpower(floatsub(player_z,tar_z),2.0)));
if(radius_z > Z_Range && radius_xy < radius_z)
{
care_z = false;
}
if(radius_xy <= Range && care_z)
{
return 1;
}
return 0;
}
C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\gamemode.pwn(17) : error 026: no matching "#if..." C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\gamemode.pwn(77) : error 029: invalid expression, assumed zero C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\gamemode.pwn(77) : error 017: undefined symbol "cmd_me" C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\gamemode.pwn(77) : error 029: invalid expression, assumed zero C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\gamemode.pwn(77) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors. |
C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\Untitled.pwn(79) : error 029: invalid expression, assumed zero C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\Untitled.pwn(79) : error 017: undefined symbol "cmd_me" C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\Untitled.pwn(79) : error 029: invalid expression, assumed zero C:\Users\Mijn pc\Desktop\SA-MP server\server\gamemodes\Untitled.pwn(79) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |