[+REP]Help me Please
#1

Hello everyone.
First here is my code :
PHP код:
CMD:lands(playeridparams[])
{
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    for(new 
xMAX_LANDSx++)
    {
    if (
PlayerInfo[playerid][pLandPerms] == 0) return  SendClientMessage(playeridCOLOR_GREY"You don't own any land.");
      if(
IsPlayerInGangZone(playeridLandInfo[x][landZone]))
      return 
SendClientMessage(playeridCOLOR_GREY"You are in your land.");
         else 
SendClientMessage(playeridCOLOR_GREY"You are not in your land.");
         {
               if(
strcmp(playernameLandInfo[x][landOwner], true) == 0)
            {
                
editingLand[playerid] = x;
                break;
            }
            else
            {
                
editingLand[playerid] = -1;
            }
        }
    }
    
ShowPlayerDialogEx(playeridLANDSMAIN,DIALOG_STYLE_LIST"Lands - Select an option""Toggle Lands on Map\nBuild\nEdit a Building\nDestroy a Building\nBuy Land\nSell Land\nDestroy all objects""Select""Cancel");
    return 
1;

Okay now as you can see in my code IF the player is in its land it should show him "you are in land"
and IF the player is not in land it should show him that "you are NOT in your land"

BUT when i type /lands in game it says "you are NOT in your land" also with this it shows me the dialog as /lands...

any help please [+REP]
Reply
#2

You gotta learn how to use control structures.

https://sampwiki.blast.hk/wiki/Control_Structures#if
Reply
#3

aw i will learn but also can you help me with it please?
Reply
#4

anyone please
[+REP] for help
Reply
#5

Hello!

Do you mean it like this?
PHP код:
CMD:lands(playerid,params[])
{
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    if(
PlayerInfo[playerid][pLandPerms] == 0)return SendClientMessage
    
for(new x;x<MAX_LANDS;x++)
    {
        if(
IsPlayerInGangZone(playerid,LandInfo[x][landZone]))
        {
            if(!
strcmp(playername,LandInfo[x][landOwner],true))
            {
                
editingLand[playerid] = x;
                
ShowPlayerDialogEx(playeridLANDSMAIN,DIALOG_STYLE_LIST"Lands - Select an option""Toggle Lands on Map\nBuild\nEdit a Building\nDestroy a Building\nBuy Land\nSell Land\nDestroy all objects""Select""Cancel");
                return 
SendClientMessage(playerid,COLOR_GREY,"You are in your land!");
            }
            else
            {
                
editingLand[playerid] = -1;
            }
        }
    }
    return 
SendClientMessage(playerid,COLOR_GREY,"You are not in your land!");

Reply
#6

now it always says you are not in your land and dont open dialog even im in my land
Reply
#7

any help?
Reply
#8

Код:
CMD:lands(playerid, params[])
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    if(PlayerInfo[playerid][pLandPerms] == 0) return  SendClientMessage(playerid, COLOR_GREY, "You don't own any land.");
    for(new x; x < MAX_LANDS; x++)
    {
	if(strcmp(playername, LandInfo[x][landOwner], true) == 0)
 	{
            if(IsPlayerInGangZone(playerid, LandInfo[x][landZone]))
            {
                SendClientMessage(playerid,COLOR_GREY,"You are in your land!");
	        editingLand[playerid] = x;
	        ShowPlayerDialogEx(playerid, LANDSMAIN,DIALOG_STYLE_LIST, "Lands - Select an option", "Toggle Lands on Map\nBuild\nEdit a Building\nDestroy a Building\nBuy Land\nSell Land\nDestroy all objects", "Select", "Cancel");
	        break;
            }
            return SendClientMessage(playerid, COLOR_GREY, "You are not in your land.");
 	}
  	editingLand[playerid] = -1;
    }
    return 1;
}
Reply
#9

same...
Reply
#10

any help please?
[+REP]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)