#include <a_samp>
#include <zcmd>
#include <sscanf>
CMD:asay(playerid, params[])
{
new falar[128];
new string[128];
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, MAX_PLAYER_NAME);
if(sscanf(params, "s", falar)) return SendClientMessage(playerid, -1,"[CORRETOR]: Use /asay [texto]");
format(string, sizeof(string),"[GLOBAL MESSENGER]: %s - %s", Nome(playerid), falar);
SendClientMessageToAll(-1, string);
return 1;
}
CMD:asay(playerid, params[])
playerid
params[]
{
new falar[128];
new string[128];
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, MAX_PLAYER_NAME);
if(sscanf(params, "s", falar)) return SendClientMessage(playerid, -1,"{FF0000}ERRO: Utilize /asay [mensagem]");
format(string, sizeof(string), "[GLOBAL MESSENGER] - %s: %s", nome, falar);
SendClientMessageToAll(-1, string);
return 1;
}
#include <a_samp>
#include <zcmd>
#include <sscanf>
CMD:asay(playerid, params[])
{
new falar[128];
new string[128];
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, MAX_PLAYER_NAME);
if(sscanf(params, "s", falar)) return SendClientMessage(playerid, -1,"[CORRETOR]: Use /asay [texto]");
format(string, sizeof(string),"[GLOBAL MESSENGER]: %s - %s", Nome(playerid), falar);
SendClientMessageToAll(-1, string);
return 1;
}
new falar[128]; new string[128];
new falar[128], string[128];
CMD:asay(playerid, params[])
{
new falar[128],new string[128], new id;
if(sscanf(params, "s", falar)) return SendClientMessage(playerid, -1,"{FFA500}[CORRETOR]{FFFFFF}: Use /asay [texto]");
format(string, sizeof(string),"[GLOBAL ADMINISTRAЗГO]: %s[%d] - %s", Nome(playerid), id,falar);
SendClientMessageToAll(-1, string);
return 1;
}
Re: Como Criar o comando "/asay" Otimo Tutorial. Dica Code: new falar[128]; new string[128]; por Code: new falar[128], string[128]; |
Acredito que essa seja uma forma de otimizaзгo do GameMode, mas faзo separadamente para ficar mais visнvel e nгo ocorrer atrapalhaзхes.
|
Otimo Tutorial.
Dica Код:
new falar[128]; new string[128]; Код:
new falar[128], string[128]; https://sampforum.blast.hk/showthread.php?tid=437499 poderia ter adicionado o ID PHP код:
|
#include <a_samp>
#include <zcmd>
#include <sscanf>
CMD:asay(playerid, params[])
{
new falar[128];
new string[128];
if(sscanf(params, "s", falar)) return SendClientMessage(playerid, -1,"[CORRETOR]: Use /asay [texto]");
if(JogadorFoAdmin){
format(string, sizeof(string),"[GLOBAL ADMINISTRAЗГO]: %s - %s", Nome(playerid), falar);
SendClientMessageToAll(-1, string);
}
if(SePlayerforSomenteJogador){
format(string, sizeof(string),"[GLOBAL MESSENGER]: %s - %s", Nome(playerid), falar);
SendClientMessageToAll(-1, string);
}
return 1;
}
e um asay dependendo da org seria assim
PHP код:
|
CMD:asay(playerid, params[])
{
new falar[128];
new string[128];
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, MAX_PLAYER_NAME);
if(sscanf(params, "s", falar)) return SendClientMessage(playerid, -1,"[CORRETOR]: Use /asay [texto]");
if(!IsPlayerAdmin(playerid))
{
format(string, sizeof(string),"[GLOBAL MESSENGER]: %s - %s", nome, falar);
SendClientMessageToAll(-1, string);
}
if(!IsPlayerAdmin(playerid) == false)
{
format(string, sizeof(string),"[GLOBAL ADMINISTRAЗГO]: %s - %s", nome, falar);
SendClientMessageToAll(-1, string);
}
return 1;
}
CMD:asay(playerid, params[])
{
//como o parametro й sу texto, use a propiб variбvel do zcmd!
if(isnull(param)) return SendClientMessage(playerid, -1,"[CORRETOR]: Use /asay [texto]");
if(IsPlayerAdmin(playerid)) //se for admin [trocar pelo seu sistema admin ou vip]
SendClientMessageToAllf(-1, "[GLOBAL ADMINISTRAЗГO]: %s - %s", GetPlayerNameEx(playerid), param);
else //player normal
SendClientMessageToAllf(-1, "[GLOBAL MESSENGER]: %s - %s", GetPlayerNameEx(playerid), param);
return 1;
}
//-------------------------------------------------------------------------------------------------------------------
//SendClientMessageToAllf eu aconcelho usar o do Plugin YSF, porque й mais rapido!
//mas tambem tem este macro:
static str[128];
#define SendClientMessagef(%0,%1,%2,%3) format(str, sizeof(str),%2,%3) && SendClientMessage(%0, %1, str)
#define SendClientMessageToAllf(%1,%2,%3) format(str, sizeof(str),%2,%3) && SendClientMessageToAll(%1, str)
//-------------------------------------------------------------------------------------------------------------------
stock GetPlayerNameEx(playerid)
{
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, MAX_PLAYER_NAME);
return nome;
}
//-------------------------------------------------------------------------------------------------------------------