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

San Andreas Multiplayer (SA-MP) => Szkript kérések => SA-MP: Szerverfejlesztés => RP/RPG kérések => A témát indította: Mokus - 2012. szeptember 10. - 22:14:14

Cím: /b
Írta: Mokus - 2012. szeptember 10. - 22:14:14
Sziasztok már volt ilyen témám hogy mi az ooc parancs?De nekem Amf meg irta de nem volt jó nemtudom miért.
Megcsinálná nekem valaki újra ami jó is lenne köszönöm elõre is.
[Nem veletek iratom meg a modom csak ezt nem értem]
Cím: /b
Írta: N@rbirock - 2012. szeptember 10. - 22:22:05
#define SendFMessage(%1,%2,%3,%4) do{new sendfstring[128];format(sendfstring,128,(%3),%4);SendClientMessage(%1,(%2),sendfstring);}while(FALSE)
CMD:b(playerid, params[])
{
new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
      new mseg[128];
if(sscanf(params,\"s[128]\",mseg)) return SendClientMessage(playerid,0xFF0000FF, \"Használat: /b [szöveg]\");
      if(IsPlayerInRangeOfPoint(playerid, 10, x, y, z))
{
SendFMessage(playerid,0xffffffAA,\"» %s mondja ((OOC: %s))\",UnderscoreToSpaceName(playerid),mseg);
}
return 1;
}
stock UnderscoreToSpaceName(playerid)
{
    new Name0[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, Name0, sizeof(Name0));
    }
    else
    {
        Name0 = \"Disconnected/Nothing\";
    }
    for(new name0 = 0; name0 < MAX_PLAYER_NAME; name0++) if(Name0[name0] == \'_\') Name0[name0] = \' \';
    return Name0;
}

 
Nekem tökéletesen megy.
Cím: /b
Írta: Mokus - 2012. szeptember 10. - 22:26:26
Õõõ milyen includek kellenek gondolom zcmd sscanf és még?
Cím: /b
Írta: N@rbirock - 2012. szeptember 10. - 22:27:23
Csak annyi.
Cím: /b
Írta: Mokus - 2012. szeptember 10. - 22:39:14
C:\\Documents and Settings\\Csalad\\Asztal\\[HUN]RPG\\filterscripts\\b.pwn(8) : warning 217: loose indentation
C:\\Documents and Settings\\Csalad\\Asztal\\[HUN]RPG\\filterscripts\\b.pwn(9) : warning 217: loose indentation
C:\\Documents and Settings\\Csalad\\Asztal\\[HUN]RPG\\filterscripts\\b.pwn(13) : error 017: undefined symbol \"FALSE\"
Pawn compiler 3.2.3664           Copyright © 1997-2006, ITB CompuPhase
1 Error.
Így tettem be scriptbe
 
#include <a_samp>
#include zcmd
#include sscanf2
    #define SendFMessage(%1,%2,%3,%4) do{new sendfstring[128];format(sendfstring,128,(%3),%4);SendClientMessage(%1,(%2),sendfstring);}while(FALSE)
    CMD:b(playerid, params[])
    {
            new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
            new mseg[128];
            if(sscanf(params,\"s[128]\",mseg)) return SendClientMessage(playerid,0xFF0000FF, \"Használat: /b [szöveg]\");
            if(IsPlayerInRangeOfPoint(playerid, 10, x, y, z))
            {
            SendFMessage(playerid,0xffffffAA,\"&#187; %s mondja ((OOC: %s))\",UnderscoreToSpaceName(playerid),mseg);
            }
            return 1;
    }
    stock UnderscoreToSpaceName(playerid)
    {
        new Name0[MAX_PLAYER_NAME];
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, Name0, sizeof(Name0));
        }
        else
        {
            Name0 = \"Disconnected/Nothing\";
        }
        for(new name0 = 0; name0 < MAX_PLAYER_NAME; name0++) if(Name0[name0] == \'_\') Name0[name0] = \' \';
        return Name0;
    }

 
De szerintem én csináltam hülyeséget
Cím: /b
Írta: gergo107 - 2012. szeptember 10. - 22:45:40
A
loose indentation

 az csak sor eltolódás, a
FALSE

 pedig: a mód elején hozz létre egy ilyet:
#define FALSE = false;
Cím: /b
Írta: N@rbirock - 2012. szeptember 10. - 22:51:51
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#pragma tabsize 0
CMD:b(playerid, params[])
{
new Float:x, Float:y, Float:z, strin[128];
    GetPlayerPos(playerid, x, y, z);
      new mseg[128];
if(sscanf(params,\"s[128]\",mseg)) return SendClientMessage(playerid,0xFF0000FF, \"Használat: /b [szöveg]\");
      if(IsPlayerInRangeOfPoint(playerid, 10, x, y, z))
{
format(strin,sizeof(strin),\"» %s mondja ((OOC: %s))\",UnderscoreToSpaceName(playerid),mseg);
SendClientMessage(playerid,0xc4ff00AA,strin);
}
return 1;
}
    stock UnderscoreToSpaceName(playerid)
    {
        new Name0[MAX_PLAYER_NAME];
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, Name0, sizeof(Name0));
        }
        else
        {
            Name0 = \"Disconnected/Nothing\";
        }
        for(new name0 = 0; name0 < MAX_PLAYER_NAME; name0++) if(Name0[name0] == \'_\') Name0[name0] = \' \';
        return Name0;
    }
Cím: /b
Írta: gergo107 - 2012. szeptember 10. - 23:13:31

if(strcmp(cmdtext, \"/b\", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= \' \'))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, \"/b [üzenet]\");
return 1;
}
format(string, sizeof(string), \"%s mondja OOC: (( %s ))\", sendername, result);
ProxDetector(B_Normal, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 1;
}

 
ProxDetector:
 

public ProxDetector(Float:radi, playerid, string[],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 = 0; i < MAX_PLAYERS; i++)
{
   if(IsPlayerConnected(i))
   {
      if(!BigEar)
      {
          new VW = GetPlayerVirtualWorld(playerid);
          new VW2 = GetPlayerVirtualWorld(i);
         GetPlayerPos(i, posx, posy, posz);
         tempposx = (oldposx -posx);
         tempposy = (oldposy -posy);
         tempposz = (oldposz -posz);
         //printf(\"DEBUG: X:%f Y:%f Z:%f\",posx,posy,posz);
         if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col1, string);
            }
         }
         else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col2, string);
            }
         }
         else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col3, string);
            }
         }
         else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col4, string);
            }
         }
         else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col5, string);
            }
         }
      }
      else
      {
         SendClientMessage(i, col1, string);
      }
   }
}
}
return 1;
}
Cím: /b
Írta: N@rbirock - 2012. szeptember 11. - 09:02:25
Idézetet írta: gergo107 date=1347311611\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"27557\" data-ipsquote-contentclass=\"forums_Topic


if(strcmp(cmdtext, \"/b\", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= \' \'))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, \"/b [üzenet]\");
return 1;
}
format(string, sizeof(string), \"%s mondja OOC: (( %s ))\", sendername, result);
ProxDetector(B_Normal, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 1;
}

 
ProxDetector:
 

public ProxDetector(Float:radi, playerid, string[],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 = 0; i < MAX_PLAYERS; i++)
{
   if(IsPlayerConnected(i))
   {
      if(!BigEar)
      {
          new VW = GetPlayerVirtualWorld(playerid);
          new VW2 = GetPlayerVirtualWorld(i);
         GetPlayerPos(i, posx, posy, posz);
         tempposx = (oldposx -posx);
         tempposy = (oldposy -posy);
         tempposz = (oldposz -posz);
         //printf(\"DEBUG: X:%f Y:%f Z:%f\",posx,posy,posz);
         if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col1, string);
            }
         }
         else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col2, string);
            }
         }
         else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col3, string);
            }
         }
         else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col4, string);
            }
         }
         else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
         {
            if(VW == VW2)
            {
               SendClientMessage(i, col5, string);
            }
         }
      }
      else
      {
         SendClientMessage(i, col1, string);
      }
   }
}
}
return 1;
}

 

De ha már zcmdt használ a módba akkor a sscanf sokkal jobb megoldás.
Cím: /b
Írta: Mokus - 2012. szeptember 11. - 11:43:32
Megoldva zárok mind a kettötöknek egy respect