Problem was in <= MAX_PLAYER_NAME should be < MAX_PLAYER_NAME but here you go better
pawn Код:
|
CMD:b(playerid, params[])
{
new string[128];
if(isnull(params)) return SCM(playerid,LIGHTBLUE,"Use: {FFFFFF}/b [text]");
format(string, sizeof(string), "%s: (( %s ))",InGameChatRemoveUnderscore(playerid),params);
ProxDetector(25.0, playerid, string, COLOR_WHITE);
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return SendClientMessage(playerid, LIGHTBLUE, "Las Vegas: Origins -{FFFFFF} Command not recognized, use {33CCFF}/help" );
return 1;
}
forward ProxDetector(Float:radi, playerid, string[],color);
public ProxDetector(Float:radi, playerid, string[],color)
{
if(PlayerInfo[playerid][Logged] == false) return 1;
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
foreach(Player,i)
{
if(IsPlayerInRangeOfPoint(i,radi,x,y,z) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i) && PlayerInfo[i][Logged] == true)
{
SendClientMessage(i,color,string);
}
}
return 1;
}
CMD:givemoney(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] < HEAD_ADMIN) return SendClientMessage(playerid, COLOR_NICERED, "Denied!");
new id,money;
if(sscanf(params, "ui",id,money)) return SendClientMessage(playerid, LIGHTBLUE, "Use:{FFFFFF} /givemoney [ID Player] [Money]");
if(PlayerInfo[id][Logged] == false) return SCM(playerid, COLOR_ERROR,"That player is Offline!");
if(id == INVALID_PLAYER_ID)return SCM(playerid,COLOR_ERROR,"Wrong ID!");
GiveHimMoney(id, money);
new str[100];
format(str,sizeof(str),"You gave{FFFFFF} %s {00C0FF}$%d",InGameChatRemoveUnderscore(id), money);
SendClientMessage(playerid,LIGHTBLUE,str);
format(str,sizeof(str),"Admin {FFFFFF} %s gave you {00C0FF}$%d ",InGameChatRemoveUnderscore(playerid),money);
SendClientMessage(id,LIGHTBLUE,str);
return 1;
}
I assume the function/macro "SCM" is returning 0; therefore, that message shows up.
|
#define SCM SendClientMessage
I doubt that, I think SCM is just a redefinition of SendClientMessage
Код:
#define SCM SendClientMessage |
I doubt that, I think SCM is just a redefinition of SendClientMessage
Код:
#define SCM SendClientMessage |
CMD:b(playerid, params[])
{
new string[128];
if(isnull(params)) return SCM(playerid,LIGHTBLUE,"Use: {FFFFFF}/b [text]");
format(string, sizeof(string), "%s: (( %s ))",InGameChatRemoveUnderscore(playerid),params);
ProxDetector(25.0, playerid, string, COLOR_WHITE);
return 1;
}
InGameChatRemoveUnderscore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i; i <= MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}
// [ DEVELOPMENT GAMEMODE ]
// INCLUDES:
#include <a_samp>
#include <zcmd>
// DEFINES:
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
// MAIN:
main()
{
print("Development Mode: rp_name.amx");
}
// CALLBACKS:
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
// COMMANDS:
CMD:b(playerid, params[])
{
new string[144];
if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /b (message).");
format(string, sizeof(string), "%s: (( %s ))", ReplaceString("_", " ", PlayerName(playerid)), params);
SendClientMessageToAll(-1, string);
return 1;
}
// FUNCTIONS:
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
stock ReplaceString(search[], replace[], source[])
{
new string[256], length;
for(new i = 0; i < strlen(source); i ++)
{
if(strlen(search) > 1 && i != (strlen(source) - 1))
{
new bool:match = false, start = i;
for(new j = 0; j < strlen(search) && !match; j ++)
{
if(source[i] != search[j] && j == 0)
{
string[length] = source[i];
match = true;
}
else
{
if(source[i] == search[j]) i ++;
else match = true;
}
}
if(match == true)
{
while(start <= i)
{
string[length] = source[start];
length ++;
start ++;
}
}
else
{
for(new j; j < strlen(replace); j ++)
{
string[length] = replace[j];
length ++;
}
i = (start + (strlen(search) - 1));
}
}
else
{
if(strlen(search) == 1 && source[i] == search[0])
{
for(new j; j < strlen(replace); j ++)
{
string[length] = replace[j];
length ++;
}
}
else
{
string[length] = source[i];
length ++;
}
}
}
string[length] = EOS;
return string;
}
stock ReplaceString(const search[],const replace[], source[], size=sizeof source) //© by Kaliber
{
new i=strfind(source,search),tmp=strlen(search);
if(i==-1) return 0;
for( ; i!=-1; i=strfind(source,search,false,i+1))
{
strdel(source,i,i+tmp),strins(source,replace,i,size);
}
return 1;
}