GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Komolos le 14 Octobre 2010, 22:32:05

Titre: Aide [/b]
Posté par: Komolos le 14 Octobre 2010, 22:32:05
Bonjour,
J'ai commencé une commande met je n'arrive pas à la faire confonctionné correctement...
Ce que j'aimerai faire si on tape /adminservice on devient administrateur en jeu et donc plus joueur donc normalement ça devrai faire administrateur dit etc...
Si on as pas tapé /adminservice : joueur dit etc....

voici la commande :

if(strcmp(cmd, "/b", true) == 0)//CHAT HRP BY ERIK
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Vous devez d'abord ouvrir une session !");
            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, "CMD: /b [Chat HRP]");
return 1;
}
if(FindIP(result)) /// Anti-Pub
    {
        SendClientMessage(playerid, COLOR_RED, "[Anti-PUB] Vous avez été kické pour avoir fait une pub ");
        new advertiser[MAX_PLAYER_NAME];
GetPlayerName(playerid, advertiser, sizeof(advertiser));
format(string, sizeof(string), "[Anti-PUB] %s a été expulsé de la ville. Raison: Pub",advertiser);
SendClientMessageToAll(COLOR_LIGHTRED,string);
BanLog(string);
          Ban(playerid);
        return 1;
  }
            format(string, sizeof(string), "%s dit:((  %s ))",sendername, result);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

    if (AdminDuty[playerid] == 1 )
{
            format(string, sizeof(string), "Administrateur dit:((  %s ))", result);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

         }
}
return 1;
}
Titre: Re : Aide [/b]
Posté par: Komolos le 16 Octobre 2010, 21:08:46
Up plz
Titre: Re : Aide [/b]
Posté par: dydjyz le 16 Octobre 2010, 22:41:07
J'ai rien compris...
Titre: Re : Aide [/b]
Posté par: Komolos le 17 Octobre 2010, 10:31:48
Enfaite si je tape /adminservice puis /b on voit :

Komolos dit : Salut
Administrateur dit : Salut

On voit les 2

J'aimerai que quand on tape la commande, on voit que Administrateur dit :
Titre: Re : Re : Aide [/b]
Posté par: dydjyz le 17 Octobre 2010, 11:17:58
return 0;

voilà ^^
Titre: Re : Aide [/b]
Posté par: Komolos le 17 Octobre 2010, 13:01:55
[code]Comme ça
[code]
if(strcmp(cmd, "/b", true) == 0)//CHAT HRP BY ERIK
{
   if(IsPlayerConnected(playerid))
   {
       if(gPlayerLogged[playerid] == 0)
       {
           SendClientMessage(playerid, COLOR_GREY, "   Vous devez d'abord ouvrir une session !");
           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, "CMD: /b [Chat HRP]");
return 1;
}
if(FindIP(result)) /// Anti-Pub
     {
         SendClientMessage(playerid, COLOR_RED, "[Anti-PUB] Vous avez été EXILER pour avoir fait une pub ");
         new advertiser[MAX_PLAYER_NAME];
GetPlayerName(playerid, advertiser, sizeof(advertiser));
format(string, sizeof(string), "[Anti-PUB] %s a été EXILER de la ville. Raison: Pub",advertiser);
SendClientMessageToAll(COLOR_LIGHTRED,string);
BanLog(string);
       Ban(playerid);
         return 1;
  }
            format(string, sizeof(string), "%s dit:((  %s ))",sendername, result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

}
return 0;
   {
   if (AdminDuty[playerid] == 1 )
{
new result[64];
            format(string, sizeof(string), "Administrateur dit:((  %s ))", result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

         }
}
return 1;
}

Ou a la fin

new result[64];
            format(string, sizeof(string), "Administrateur dit:((  %s ))", result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

         }
}
return 0;
}
[/code][/code]
Titre: Re : Aide [/b]
Posté par: Komolos le 19 Octobre 2010, 12:40:40
Petit up
Merci d'avance =D
Titre: Re : Aide [/b]
Posté par: scott1 le 19 Octobre 2010, 13:19:51
Fait


if (AdminDuty[playerid] == 1 )
{
   ton texte
}
else
{
 ton texte quand il est pas en admin
}
Titre: Re : Re : Aide [/b]
Posté par: dydjyz le 19 Octobre 2010, 14:54:09
[code]Comme ça
[code]
if(strcmp(cmd, "/b", true) == 0)//CHAT HRP BY ERIK
{
   if(IsPlayerConnected(playerid))
   {
       if(gPlayerLogged[playerid] == 0)
       {
           SendClientMessage(playerid, COLOR_GREY, "   Vous devez d'abord ouvrir une session !");
           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, "CMD: /b [Chat HRP]");
return 1;
}
if(FindIP(result)) /// Anti-Pub
     {
         SendClientMessage(playerid, COLOR_RED, "[Anti-PUB] Vous avez été EXILER pour avoir fait une pub ");
         new advertiser[MAX_PLAYER_NAME];
GetPlayerName(playerid, advertiser, sizeof(advertiser));
format(string, sizeof(string), "[Anti-PUB] %s a été EXILER de la ville. Raison: Pub",advertiser);
SendClientMessageToAll(COLOR_LIGHTRED,string);
BanLog(string);
       Ban(playerid);
         return 1;
  }
        if(AdminDuty[playerid] == 0)
      {
            format(string, sizeof(string), "%s dit:((  %s ))",sendername, result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);
return 1;
                 }
}
return 0;
   {
  else if (AdminDuty[playerid] == 1 )
{
new result[64];
            format(string, sizeof(string), "Administrateur dit:((  %s ))", result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

         }
}
return 1;
}

Ou a la fin

new result[64];
            format(string, sizeof(string), "Administrateur dit:((  %s ))", result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

         }
}
return 0;
}
[/code][/code]

Sa devrait marcher jpense
Titre: Re : Aide [/b]
Posté par: Komolos le 19 Octobre 2010, 16:11:37
J'ai fait comme ça sa n'as pas marché :'(

EDIT: je teste ^^'
Titre: Re : Aide [/b]
Posté par: dydjyz le 19 Octobre 2010, 16:14:16
Donne les erreur si sa marche pas
Titre: Re : Aide [/b]
Posté par: Komolos le 19 Octobre 2010, 17:06:25
J'ai fait comme vous avez dit sa n'as pas marché, j'ai essayé ça comme ça à marché :

if(strcmp(cmd, "/b", true) == 0)//CHAT HRP BY ERIK
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Vous devez d'abord ouvrir une session !");
            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, "CMD: /b [Chat HRP]");
return 1;
}
if(FindIP(result)) /// Anti-Pub
    {
        SendClientMessage(playerid, COLOR_RED, "[Anti-PUB] Vous avez été ÉXILER pour avoir fait une pub ");
        new advertiser[MAX_PLAYER_NAME];
GetPlayerName(playerid, advertiser, sizeof(advertiser));
format(string, sizeof(string), "[Anti-PUB] %s a été ÉXILER de la ville. Raison: Pub",advertiser);
SendClientMessageToAll(COLOR_LIGHTRED,string);
BanLog(string);
          Ban(playerid);
        return 1;
  }
        if(AdminDuty[playerid] == 0)
      {
            format(string, sizeof(string), "%s dit:((  %s ))",sendername, result);
            SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);
}
    if (AdminDuty[playerid] == 1 )
{
            format(string, sizeof(string), "Administrateur dit:((  %s ))", result);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);

         }
}
return 1;
}

Maintenant j'ai un autre problème j'aimerai savoir comment supprimé le Speudo, une fois en AdminDuty.
Titre: Re : Aide [/b]
Posté par: Komolos le 19 Octobre 2010, 17:19:17
Merci Dizzy ^^'