CMD problem
#1

hello , this cmd is supposed to steal money from another player

Код:
	if(strcmp(cmd, "/ciordeste", true) == 0)
 	{
 	    if(PlayerData[playerid][pMember] + PlayerData[playerid][pLeader] == 5)
 	    {
 	    	if(CiorditTimp[playerid] == 0)
 	    	{
 	    	    new victima = GetClosestPlayer(playerid);
 	    	    if(GetDistanceBetweenPlayers(playerid,victima) < 5)
				{
				    if(PlayerData[victima][pMember] + PlayerData[victima][pLeader] != 5)
				    {
					    new banili = random(1000) + 500;
		 	    	    new nume1[24],
		 	    	        nume2[24];
		 	    	    GetPlayerName(playerid, nume1, sizeof(nume1));
		 	    	    GetPlayerName(victima, nume2, sizeof(nume2));
		 	    	    format(string, sizeof(string), "%s ti-a ciordit {228B22}${FFFFFF}%d din buzunar!", nume1, banili);
		 	    	    SendClientMessage(victima, COLOR_WHITE, string);
		 	    	    format(string, sizeof(string), "I-ai ciordit lui %s {228B22}${FFFFFF}%d din buzunar!", nume2, banili);
		 	    	    SendClientMessage(playerid, COLOR_WHITE, string);
		 	    	    GivePlayerCash(playerid, banili);
		 	    	    GivePlayerCash(victima, -banili);
						CiorditTimp[playerid] = 1;
						SetTimerEx("ciordealatimp", 120000, false, "i", playerid);
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "Nu iti poti ciordi fratele!");
					    return 1;
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "Nu e nimeni langa tine!");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Trebuie sa astepti 2 minute intre ciordiri!");
		    	return 1;
			}
		}
		else
		{
		    SendClientMessage(playerid, COLOR_GREY, "Nu faci parte din factiunea Rromi!");
	    	return 1;
		}
		return 1;
	}
but when i tipe the command it doesen't work even if i'm in the right faction
Faction ID is 5
Reply
#2

I think the problem is in those 2 codes
Код:
if(PlayerData[playerid][pMember] + PlayerData[playerid][pLeader] == 5)
Код:
if(PlayerData[victima][pMember] + PlayerData[victima][pLeader] != 5)
If your faction data is "pLeader"
they should be like this:
Код:
if(PlayerData[playerid][pLeader] == 5)
Код:
if(PlayerData[victima][pLeader] != 5)
Reply
#3

pawn Код:
if(PlayerData[playerid][pMember] || PlayerData[playerid][pLeader] == 5)
Try that.
Reply
#4

Код:
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55537) : error 029: invalid expression, assumed zero
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55537) : warning 215: expression has no effect
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55537) : error 001: expected token: ";", but found "if"
for
Код:
	if(strcmp(cmd, "/ciordeste", true) == 0)
 	{
 	     if(PlayerData[playerid][pMember] ==5) || PlayerData[playerid][pLeader] == 5)
 	    {
 	    	if(CiorditTimp[playerid] == 0)
 	    	{
 	    	    new victima = GetClosestPlayer(playerid);
 	    	    if(GetDistanceBetweenPlayers(playerid,victima) < 5)
				{
				    if(PlayerData[victima][pMember] !=5) || if(PlayerData[victima][pLeader] != 5)
				    {
					    new banili = random(1000) + 500;
		 	    	    new nume1[24],
		 	    	        nume2[24];
		 	    	    GetPlayerName(playerid, nume1, sizeof(nume1));
		 	    	    GetPlayerName(victima, nume2, sizeof(nume2));
		 	    	    format(string, sizeof(string), "%s ti-a ciordit {228B22}${FFFFFF}%d din buzunar!", nume1, banili);
		 	    	    SendClientMessage(victima, COLOR_WHITE, string);
		 	    	    format(string, sizeof(string), "I-ai ciordit lui %s {228B22}${FFFFFF}%d din buzunar!", nume2, banili);
		 	    	    SendClientMessage(playerid, COLOR_WHITE, string);
		 	    	    GivePlayerCash(playerid, banili);
		 	    	    GivePlayerCash(victima, -banili);
						CiorditTimp[playerid] = 1;
						SetTimerEx("ciordealatimp", 120000, false, "i", playerid);
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "Nu iti poti ciordi fratele!");
					    return 1;
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "Nu e nimeni langa tine!");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Trebuie sa astepti 2 minute intre ciordiri!");
		    	return 1;
			}
		}
		else
		{
		    SendClientMessage(playerid, COLOR_GREY, "Nu faci parte din factiunea Rromi!");
	    	return 1;
		}
		return 1;
	}
Reply
#5

PHP код:
    if(strcmp(cmd"/ciordeste"true) == 0)
     {
        if(
PlayerData[playerid][pMember] == 5) || PlayerData[playerid][pLeader] == 5)
         {
             if(
CiorditTimp[playerid] == 0)
             {
                 new 
victima GetClosestPlayer(playerid);
                 if(
GetDistanceBetweenPlayers(playerid,victima) < 5)
                {
                    if(
PlayerData[victima][pMember] != 5) || PlayerData[victima][pLeader] != 5)
                    {
                        new 
banili random(1000) + 500;
                         new 
nume1[24], nume2[24];
                         
GetPlayerName(playeridnume1sizeof(nume1));
                         
GetPlayerName(victimanume2sizeof(nume2));
                         
format(stringsizeof(string), "%s ti-a ciordit {228B22}${FFFFFF}%d din buzunar!"nume1banili);
                         
SendClientMessage(victimaCOLOR_WHITEstring);
                         
format(stringsizeof(string), "I-ai ciordit lui %s {228B22}${FFFFFF}%d din buzunar!"nume2banili);
                         
SendClientMessage(playeridCOLOR_WHITEstring);
                         
GivePlayerCash(playeridbanili);
                         
GivePlayerCash(victima, -banili);
                        
CiorditTimp[playerid] = 1;
                        
SetTimerEx("ciordealatimp"120000false"i"playerid);
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GREY"Nu iti poti ciordi fratele!");
                        return 
1;
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"Nu e nimeni langa tine!");
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"Trebuie sa astepti 2 minute intre ciordiri!");
                return 
1;
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"Nu faci parte din factiunea Rromi!");
            return 
1;
        }
        return 
1;
    } 
Reply
#6

Код:
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55530) : error 029: invalid expression, assumed zero
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55530) : warning 215: expression has no effect
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55530) : error 001: expected token: ";", but found ")"
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55530) : error 029: invalid expression, assumed zero
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55530) : fatal error 107: too many error messages on one line
if(PlayerData[playerid][pMember] == 5) || PlayerData[playerid][pLeader] == 5) // is line 55530
Reply
#7

PHP код:
    if(strcmp(cmd"/ciordeste"true) == 0)
     {
        if(
PlayerData[playerid][pMember] == 5) || PlayerData[playerid][pLeader] == 5)
         {
             if(
CiorditTimp[playerid] == 0)
             {
                 new 
victima GetClosestPlayer(playerid);
                 if(
GetDistanceBetweenPlayers(playerid,victima) < 5)
                {
                    if(
PlayerData[victima][pMember] != || PlayerData[victima][pLeader] != 5)
                    {
                        new 
banili random(1000) + 500;
                         new 
nume1[24], nume2[24];
                         
GetPlayerName(playeridnume1sizeof(nume1));
                         
GetPlayerName(victimanume2sizeof(nume2));
                         
format(stringsizeof(string), "%s ti-a ciordit {228B22}${FFFFFF}%d din buzunar!"nume1banili);
                         
SendClientMessage(victimaCOLOR_WHITEstring);
                         
format(stringsizeof(string), "I-ai ciordit lui %s {228B22}${FFFFFF}%d din buzunar!"nume2banili);
                         
SendClientMessage(playeridCOLOR_WHITEstring);
                         
GivePlayerCash(playeridbanili);
                         
GivePlayerCash(victima, -banili);
                        
CiorditTimp[playerid] = 1;
                        
SetTimerEx("ciordealatimp"120000false"i"playerid);
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GREY"Nu iti poti ciordi fratele!");
                        return 
1;
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"Nu e nimeni langa tine!");
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"Trebuie sa astepti 2 minute intre ciordiri!");
                return 
1;
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"Nu faci parte din factiunea Rromi!");
            return 
1;
        }
        return 
1;
    } 
Reply
#8


PHP код:
enum pInfo
{
pMember,
pLeader,
}


new 
PlayerData[MAX_PLAYERS][pInfo];


new 
CiorditTimp[MAX_PLAYERS];

CMD:ciordeste(playerid,params[]) {
 if(
PlayerData[playerid][pMember] == || PlayerData[playerid][pLeader] == 5)
 {
             if(
CiorditTimp[playerid] == 0)
             {
                 new 
victima GetClosestPlayer(playerid);
                 if(
GetDistanceBetweenPlayers(playerid,victima) < 5)
                {
                    if(
PlayerData[victima][pMember] != || PlayerData[victima][pLeader] != 5)
                    {
                         new 
banili random(1000) + 500;
                         new 
string[128];
                         new 
nume1[24], nume2[24];
                         
GetPlayerName(playeridnume1sizeof(nume1));
                         
GetPlayerName(victimanume2sizeof(nume2));
                         
format(stringsizeof(string), "%s ti-a ciordit {228B22}${FFFFFF}%d din buzunar!"nume1banili);
                         
SendClientMessage(victimaCOLOR_WHITEstring);
                         
format(stringsizeof(string), "I-ai ciordit lui %s {228B22}${FFFFFF}%d din buzunar!"nume2banili);
                         
SendClientMessage(playeridCOLOR_WHITEstring);
                         
GivePlayerCash(playeridbanili);
                         
GivePlayerCash(victima, -banili);
                         
CiorditTimp[playerid] = 1;
                         
SetTimerEx("ciordealatimp"120000false"i"playerid);
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GREY"Nu iti poti ciordi fratele!");
                        return 
1;
                    }
                    }
                    else
                    {
                    
SendClientMessage(playeridCOLOR_GREY"Nu e nimeni langa tine!");
                    return 
1;
                    }
                    }
                    else
                    {
                
SendClientMessage(playeridCOLOR_GREY"Trebuie sa astepti 2 minute intre ciordiri!");
                return 
1;
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"Nu faci parte din factiunea Rromi!");
            return 
1;
        }
 return 
1;

Reply
#9

Quote:
Originally Posted by jlalt
Посмотреть сообщение

PHP код:
enum pInfo
{
pMember,
pLeader,
}
new 
PlayerData[MAX_PLAYERS][pInfo];
new 
CiorditTimp[MAX_PLAYERS];
CMD:ciordeste(playerid,params[]) {
 if(
PlayerData[playerid][pMember] == || PlayerData[playerid][pLeader] == 5)
 {
             if(
CiorditTimp[playerid] == 0)
             {
                 new 
victima GetClosestPlayer(playerid);
                 if(
GetDistanceBetweenPlayers(playerid,victima) < 5)
                {
                    if(
PlayerData[victima][pMember] != || PlayerData[victima][pLeader] != 5)
                    {
                         new 
banili random(1000) + 500;
                         new 
string[128];
                         new 
nume1[24], nume2[24];
                         
GetPlayerName(playeridnume1sizeof(nume1));
                         
GetPlayerName(victimanume2sizeof(nume2));
                         
format(stringsizeof(string), "%s ti-a ciordit {228B22}${FFFFFF}%d din buzunar!"nume1banili);
                         
SendClientMessage(victimaCOLOR_WHITEstring);
                         
format(stringsizeof(string), "I-ai ciordit lui %s {228B22}${FFFFFF}%d din buzunar!"nume2banili);
                         
SendClientMessage(playeridCOLOR_WHITEstring);
                         
GivePlayerCash(playeridbanili);
                         
GivePlayerCash(victima, -banili);
                         
CiorditTimp[playerid] = 1;
                         
SetTimerEx("ciordealatimp"120000false"i"playerid);
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GREY"Nu iti poti ciordi fratele!");
                        return 
1;
                    }
                    }
                    else
                    {
                    
SendClientMessage(playeridCOLOR_GREY"Nu e nimeni langa tine!");
                    return 
1;
                    }
                    }
                    else
                    {
                
SendClientMessage(playeridCOLOR_GREY"Trebuie sa astepti 2 minute intre ciordiri!");
                return 
1;
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"Nu faci parte din factiunea Rromi!");
            return 
1;
        }
 return 
1;

Код:
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55535) : warning 219: local variable "PlayerData" shadows a variable at a preceding level
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55538) : warning 219: local variable "CiorditTimp" shadows a variable at a preceding level
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55540) : error 017: undefined symbol "ciordeste"
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55551) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55590) : warning 225: unreachable code
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55592) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55592) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55599) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55599) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55609) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55609) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55610) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55610) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55611) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55611) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55613) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55613) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55615) : warning 213: tag mismatch
Reply
#10

Quote:
Originally Posted by Ax3l123
Посмотреть сообщение
Код:
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55535) : warning 219: local variable "PlayerData" shadows a variable at a preceding level
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55538) : warning 219: local variable "CiorditTimp" shadows a variable at a preceding level
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55540) : error 017: undefined symbol "ciordeste"
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55551) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55590) : warning 225: unreachable code
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55592) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55592) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55599) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55599) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55609) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55609) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55610) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55610) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55611) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55611) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55613) : warning 213: tag mismatch
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55613) : error 032: array index out of bounds (variable "PlayerData")
C:\Users\Alex\Desktop\BloWn GM\gamemodes\Carbon.pwn(55615) : warning 213: tag mismatch
don't add the:
PHP код:
enum pInfo
{
pMember,
pLeader,
}
new 
PlayerData[MAX_PLAYERS][pInfo];
new 
CiorditTimp[MAX_PLAYERS]; 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)