GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: buci11 - 2012. január 02. - 13:37:16

Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: buci11 - 2012. január 02. - 13:37:16
nem megy mert beírom hogy /me blabla és azt írja mint amikor simán /me t írok tehát hogy hogyan kell használni
[pawn]CMD:me(playerid, params[])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new cselekmeny;
new name[MAX_PLAYER_NAME], string[100+MAX_PLAYER_NAME];
for(new i=0;i<MAX_PLAYERS;i++)
{
   if(IsPlayerConnected(i)==1)
   {
      if(IsPlayerInRangeOfPoint(i, 20, x, y, z))
      {
         GetPlayerName(playerid, name, sizeof(name));
         if(sscanf(params,\"z\",cselekmeny)) return SendClientMessage(playerid,COLOR_AQUA,\"Használat:/me [Cselekmény]\");
         format(string, sizeof(string), \"*%s %s\", name , cselekmeny);
         SendClientMessage(i,COLOR_YELLOW,string);
      }
   }
}
return 1;
}[/pawn]
Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: IXT - 2012. január 02. - 13:41:42
COMMAND:me(playerid, params[])
{
    new SenderName[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,SenderName,sizeof(SenderName));
    if(isnull(params)) return SendClientMessage(playerid, 0xFFFF00AA,\"HIBA: hasznald /me [cselekves]\");
    format(string, sizeof(string), \"*%s %s\", SenderName, params);
    SendClientMessageToAll( 0xFFFF00AA, string);
    return 1;
}

 
nekem igy van
Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: UppeR! - 2012. január 02. - 13:44:56
#include <a_samp>
#include <zcmd>
#define      COLOR_PURPLE          0xC2A2DAAA
#define      COLOR_AQUA            0x7CFC00AA
forward ProxDetector(Float:radi, playerid, strp[], col1, col2, col3, col4, col5);
public ProxDetector(Float:radi, playerid, strp[], col1, col2, col3, col4, col5) {
    if(IsPlayerConnected(playerid)) {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i)) {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if(((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) SendClientMessage(i, col1, strp);
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) SendClientMessage(i, col2, strp);
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) SendClientMessage(i, col3, strp);
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) SendClientMessage(i, col4, strp);
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) SendClientMessage(i, col5, strp);
            }
        }
    }
    return 1;
}
CMD:me(playerid, params[]) {
if(isnull(params)) return SendClientMessage(playerid,COLOR_AQUA,\"Használat:/me [Cselekmény]\");
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
format(str, 128, \"%s %s.\", name, params);
ProxDetector(20.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SetPlayerChatBubble(playerid, params, COLOR_PURPLE, 25.0, 8000);
return 1;
}
Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: buci11 - 2012. január 02. - 14:07:30
ez ennyire bonyolult? :D nekem amúgy erre 21 errort ír
Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: dexi - 2012. január 02. - 14:14:01
lol, mi az a \"z\" ott? Amit beírsz az egy string, megkell adnod a karakterlánchosszúságát
 

new cselekmeny[128];

 
és akkor az sscanf-ba azt kell írnod hogy
 
.......\"s[128]\",cselekmeny......
Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: UppeR! - 2012. január 02. - 14:15:41
Módosítottam, mert én foreach-ot használtam benne.
Nem bonyolult, a ProxDetector függvényt bármilyen más parancsban felhasználhatod.
Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: dexi - 2012. január 02. - 14:17:03
CMD:me(playerid, params&#91;])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new cselekmeny[128];
new name[MAX_PLAYER_NAME], string[100+MAX_PLAYER_NAME];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i)==1)
{
   if(IsPlayerInRangeOfPoint(i, 20, x, y, z))
   {
      GetPlayerName(playerid, name, sizeof(name));
      if(sscanf(params,\"s[128]\",cselekmeny)) return SendClientMessage(playerid,COLOR_AQUA,\"Használat:/me [Cselekmény]\");
      format(string, sizeof(string), \"*%s %s.\", name , cselekmeny);
      SendClientMessage(i,COLOR_YELLOW,string);
   }
}
}
return 1;
}

 
Tess.
Cím: aki ért hozzá kérem kijavítaná a /me parancsom?
Írta: buci11 - 2012. január 02. - 15:52:19
köszi megvan zárok