[POMOC]/pm

Započeo William Johnson, Novembar 27, 2011, 10:45:47 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Streetstories
Detaljan opis problema: kad ocu da posaljem /Pm pokaze adminima 3 put kao da sam poslao a poslo jednom.. Jednom pise da sam kao GM poslo a uopce nisam GM! i 2 put pokaze da je admin poslo

if(strcmp(cmd, "/pm", true) == 0 || strcmp(cmd, "/pm", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Nisi logiran!");
            return 1;
        }
        if(PlayerInfo[playerid][pAdmin] <= 1337 || PlayerInfo[playerid][pGameMaster] <= 4)
        {
                tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /pm [ID/Dio Imena] [text]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
    {
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemozes sam sebi poslati PM!");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[300];
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, "Koristi: (/pm) [ID/Dio Imena] [text]");
return 1;
}
format(string, sizeof(string), "{00FF00}GameMaster {00FF00}%s: %s", sendername, result);
SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "|GM|%s[%d] > %s[%d] : {FFFFFF}%s.",sendername, playerid, giveplayer, giveplayerid, result);
SendGameMasterMessage(PM., string);
if(PlayerInfo[playerid][pGameMaster] <= 4)

format(string, sizeof(string), "{00AFFF}Administrator %s: %s", sendername, result);
SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "|A|%s[%d] > %s[%d] : {FFFFFF}%s.",sendername, playerid, giveplayer, giveplayerid, result);
SendGameMasterMessage(PM., string);
if(PlayerInfo[playerid][pAdmin] >= 1)

return 1;
}
}
else
{
format(string, sizeof(string), "   %d nije na serveru.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
else
{
    SendClientMessage(playerid, COLOR_GRAD1, " Nisi GM!!");
    return 1;
}
}
return 1;
}

Dio skripte:
Neke slike/video za lakse dobivanje pomoci(neobavezno):

ovo if(PlayerInfo[playerid][pAdmin] <= 1337 || PlayerInfo[playerid][pGameMaster] <= 4)
prepravi u ovo if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pGameMaster] >= 4)

i dole imas if(PlayerInfo[playerid][pGameMaster] <= 4)
i if(PlayerInfo[playerid][pAdmin] >= 1)
to obrisi ne treba ti
Poslednja Izmena: Novembar 27, 2011, 11:39:59 PRE PODNE od Nenad










Services
Web Designing
Graphic Designing
PAWN Scripting


Ako si na tom svom serveru stavio sebi i admina i gamemastera, onda ti izbacuje oboje.. skini sebi jedno od to 2 i nece vise ;)



Ma samo sam HEAD i opet mi 2 put posalje.. :S

probaj ovako... trebalo bi da radi...

if(strcmp(cmd, "/pm", true) == 0 || strcmp(cmd, "/pm", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Nisi logiran!");
            return 1;
        }
        if(PlayerInfo[playerid][pAdmin] <= 1337 || PlayerInfo[playerid][pGameMaster] <= 4)
        {
                tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /pm [ID/Dio Imena] [text]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
    {
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemozes sam sebi poslati PM!");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[300];
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, "Koristi: (/pm) [ID/Dio Imena] [text]");
return 1;
}
if(PlayerInfo[playerid][pGameMaster] <= 4)
{
format(string, sizeof(string), "{00FF00}GameMaster {00FF00}%s: %s", sendername, result);
SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "|GM|%s[%d] > %s[%d] : {FFFFFF}%s.",sendername, playerid, giveplayer, giveplayerid, result);
SendGameMasterMessage(PM., string);
}

if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "{00AFFF}Administrator %s: %s", sendername, result);
SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "|A|%s[%d] > %s[%d] : {FFFFFF}%s.",sendername, playerid, giveplayer, giveplayerid, result);
SendGameMasterMessage(PM., string);
}

return 1;
}
}
else
{
format(string, sizeof(string), "   %d nije na serveru.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
else
{
    SendClientMessage(playerid, COLOR_GRAD1, " Nisi GM!!");
    return 1;
}
}
return 1;
}


btw, msm da je bolej da sa pm promenis u /odg
Poslednja Izmena: Novembar 27, 2011, 19:57:09 POSLE PODNE od [BR]Maki187

opet isto -.-" nznm sta je to :S nemam pojma zasto nevelja :SS

moja greska, sry...
probaj ovako... zaboravio sam else  :D

if(strcmp(cmd, "/pm", true) == 0 || strcmp(cmd, "/pm", true) == 0)  
  {  
      if(IsPlayerConnected(playerid))  
      {  
          if(gPlayerLogged[playerid] == 0)  
          {  
              SendClientMessage(playerid, COLOR_GREY, "   Nisi logiran!");  
              return 1;  
          }  
          if(PlayerInfo[playerid][pAdmin] <= 1337 || PlayerInfo[playerid][pGameMaster] <= 4)  
          {  
               tmp = strtok(cmdtext, idx);  
           if(!strlen(tmp))  
           {  
              SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /pm [ID/Dio Imena] [text]");  
              return 1;  
           }  
           giveplayerid = ReturnUser(tmp);  
           if (IsPlayerConnected(giveplayerid))  
           {  
               if(giveplayerid != INVALID_PLAYER_ID)  
               {  
                 GetPlayerName(playerid, sendername, sizeof(sendername));  
                 GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));  
                 if(giveplayerid == playerid)  
                 {  
                    SendClientMessage(playerid, COLOR_GRAD2, "Nemozes sam sebi poslati PM!");  
                    return 1;  
                 }  
                 new length = strlen(cmdtext);  
                 while ((idx < length) && (cmdtext[idx] <= ' '))  
                 {  
                    idx++;  
                 }  
                 new offset = idx;  
                 new result[300];  
                 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, "Koristi: (/pm) [ID/Dio Imena] [text]");  
                    return 1;  
                 }  
                 if(PlayerInfo[playerid][pGameMaster] <= 4)  
                 {  
                 format(string, sizeof(string), "{00FF00}GameMaster {00FF00}%s: %s", sendername, result);  
                 SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);  
                 format(string, sizeof(string), "|GM|%s[%d] > %s[%d] : {FFFFFF}%s.",sendername, playerid, giveplayer, giveplayerid, result);  
                 SendGameMasterMessage(PM., string);  
                 }  
                   
                 else if(PlayerInfo[playerid][pAdmin] >= 1)  
                 {  
                 format(string, sizeof(string), "{00AFFF}Administrator %s: %s", sendername, result);  
                 SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);  
                 format(string, sizeof(string), "|A|%s[%d] > %s[%d] : {FFFFFF}%s.",sendername, playerid, giveplayer, giveplayerid, result);  
                 SendGameMasterMessage(PM., string);  
                 }  
 
                 return 1;  
              }  
           }  
           else  
           {  
              format(string, sizeof(string), "   %d nije na serveru.", giveplayerid);  
              SendClientMessage(playerid, COLOR_GRAD1, string);  
           }  
        }  
        else  
        {  
            SendClientMessage(playerid, COLOR_GRAD1, " Nisi GM!!");  
            return 1;  
        }  
     }  
     return 1;  
  }  
Poslednja Izmena: Novembar 27, 2011, 23:31:42 POSLE PODNE od [BR]Maki187