code is not reached...
#1

Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
	printf("%d",checkpointid);
	printf("%d",dcps[checkpointid]);
	if(dcps[checkpointid] != 0)
	{
	    printf("cp");
	    if(GetPlayerVehicleID(playerid) == tvid[playerid])
	    {
	        ShowPlayerDialog(playerid,34,DIALOG_STYLE_LIST,"Dealer:","Upgrades\nSell Vehicle\nLicense Plate\t$5000","Ok","Exit");
	    }
	}
	if(corg[checkpointid] != 0)
	{
		new q[128];
		format(q,128,"SELECT * FROM orgs WHERE ID=%d",corg[checkpointid]);
		mysql_query(q);
		mysql_store_result();
		mysql_fetch_row_format(q, "|");
		new field[3][32];
		explode(q,field,"|");
		format(coname[checkpointid],32,"%s",field[1]);
		mysql_free_result();
  		if(corg[checkpointid] != org[playerid])
       	{
        	new ss[128];
	       	format(ss,128,"\n{E1E4AA}Organization:{FFFFFF}%s\n{E1E4AA}ID:{FFFFFF}%d",coname[checkpointid],corg[checkpointid]);
			ShowPlayerDialog(playerid, 31,DIALOG_STYLE_MSGBOX,"Organization:",ss,"Ok","Cancel");
       	}
	    if(corg[checkpointid]==org[playerid])
       	{
        	new s[128];
        	format(s,128,"%s",oname[playerid]);
        	if(leader[playerid]!=1)
       		{
           		ShowPlayerDialog(playerid, 30, DIALOG_STYLE_LIST, s, "Members\nResign","Ok","Cancel");
       		}
           	else
       		{
        		ShowPlayerDialog(playerid, 30, DIALOG_STYLE_LIST, s, "Members","Ok","Cancel");
       		}
        }
   	}
	if(checkpointid == dcp[0])
	{
    	ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Welcome to driving school,", "1.Take Theory Test.\n2.Take Practical Test.", "ok","cancel");
    	return 1;
	}
	if(checkpointid == bpickup)
  	{
	   	ShowPlayerDialog(playerid,15,DIALOG_STYLE_LIST,"Welcome to the bank.\nWhat would you like to do today?", "General Banking\nCredit Cards","Ok","Cancel");
   	}
	if(cpjob[checkpointid] != 0)
	{
		if(cpjob[checkpointid] != job[playerid])
       	{
			new s[128],c[128];
			format(c,128,"%s",cjname[checkpointid]);
			format(s,128,"Do you want to work as a %s?",cjname[checkpointid]);
			ShowPlayerDialog(playerid,28,DIALOG_STYLE_MSGBOX,c,s,"Yes","No");
			tjcp[playerid]=checkpointid;
		}
		else
    	{
           	new s[128],c[128];
			format(c,128,"%s",cjname[checkpointid]);
			format(s,128,"Do you want to leave your job?",cjname[checkpointid]);
			ShowPlayerDialog(playerid,29,DIALOG_STYLE_MSGBOX,c,s,"Yes","No");
		}
	}
	if(shop[checkpointid]!=0)
	{
		new s[64];
		format(s,sizeof(s),"%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d",clothes[shop[checkpointid]][0],clothes[shop[checkpointid]][1],clothes[shop[checkpointid]][2],clothes[shop[checkpointid]][3],clothes[shop[checkpointid]][4],clothes[shop[checkpointid]][5],clothes[shop[checkpointid]][6],clothes[shop[checkpointid]][7],clothes[shop[checkpointid]][8],clothes[shop[checkpointid]][9]);
		ShowPlayerDialog(playerid,32,DIALOG_STYLE_LIST,"Clothes:",s,"Ok","Cancel");
		strcp[playerid]=shop[checkpointid];
	}
	if(mycp[checkpointid] != 0)
	{
	   	ShowPlayerDialog(playerid,33,DIALOG_STYLE_LIST,"24-7:","Mobile\r$650","Ok","Cancel");
	}
	return 1;
}
thats the whole of my Onplayerenter....

the thing is the last codes (like shop and mycp) are not reachable. when i enter those cps nthn happens and if i put that code in the begining of the public (near dcps[cp]) it works. what do i do to make it reachable at the end?
Reply
#2

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    printf("%d",checkpointid);
    printf("%d",dcps[checkpointid]);
    if(dcps[checkpointid] != 0)
    {
        printf("cp");
        if(GetPlayerVehicleID(playerid) == tvid[playerid])
        {
            ShowPlayerDialog(playerid,34,DIALOG_STYLE_LIST,"Dealer:","Upgrades\nSell Vehicle\nLicense Plate\t$5000","Ok","Exit");
        }
    }
    if(corg[checkpointid] != 0)
    {
        new q[128];
        format(q,128,"SELECT * FROM orgs WHERE ID=%d",corg[checkpointid]);
        mysql_query(q);
        mysql_store_result();
        mysql_fetch_row_format(q, "|");
        new field[3][32];
        explode(q,field,"|");
        format(coname[checkpointid],32,"%s",field[1]);
        mysql_free_result();
        if(corg[checkpointid] != org[playerid])
        {
            new ss[128];
            format(ss,128,"\n{E1E4AA}Organization:{FFFFFF}%s\n{E1E4AA}ID:{FFFFFF}%d",coname[checkpointid],corg[checkpointid]);
            ShowPlayerDialog(playerid, 31,DIALOG_STYLE_MSGBOX,"Organization:",ss,"Ok","Cancel");
        }
        if(corg[checkpointid]==org[playerid])
        {
            new s[128];
            format(s,128,"%s",oname[playerid]);
            if(leader[playerid]!=1)
            {
                ShowPlayerDialog(playerid, 30, DIALOG_STYLE_LIST, s, "Members\nResign","Ok","Cancel");
            }
            else
            {
                ShowPlayerDialog(playerid, 30, DIALOG_STYLE_LIST, s, "Members","Ok","Cancel");
            }
        }
    }
    if(checkpointid == dcp[0])
    {
        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Welcome to driving school,", "1.Take Theory Test.\n2.Take Practical Test.", "ok","cancel");
        }
    if(checkpointid == bpickup)
    {
        ShowPlayerDialog(playerid,15,DIALOG_STYLE_LIST,"Welcome to the bank.\nWhat would you like to do today?", "General Banking\nCredit Cards","Ok","Cancel");
    }
    if(cpjob[checkpointid] != 0)
    {
        if(cpjob[checkpointid] != job[playerid])
        {
            new s[128],c[128];
            format(c,128,"%s",cjname[checkpointid]);
            format(s,128,"Do you want to work as a %s?",cjname[checkpointid]);
            ShowPlayerDialog(playerid,28,DIALOG_STYLE_MSGBOX,c,s,"Yes","No");
            tjcp[playerid]=checkpointid;
        }
        else
        {
            new s[128],c[128];
            format(c,128,"%s",cjname[checkpointid]);
            format(s,128,"Do you want to leave your job?",cjname[checkpointid]);
            ShowPlayerDialog(playerid,29,DIALOG_STYLE_MSGBOX,c,s,"Yes","No");
        }
    }
    if(shop[checkpointid]!=0)
    {
        new s[64];
        format(s,sizeof(s),"%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d",clothes[shop[checkpointid]][0],clothes[shop[checkpointid]][1],clothes[shop[checkpointid]][2],clothes[shop[checkpointid]][3],clothes[shop[checkpointid]][4],clothes[shop[checkpointid]][5],clothes[shop[checkpointid]][6],clothes[shop[checkpointid]][7],clothes[shop[checkpointid]][8],clothes[shop[checkpointid]][9]);
        ShowPlayerDialog(playerid,32,DIALOG_STYLE_LIST,"Clothes:",s,"Ok","Cancel");
        strcp[playerid]=shop[checkpointid];
    }
    if(mycp[checkpointid] != 0)
    {
        ShowPlayerDialog(playerid,33,DIALOG_STYLE_LIST,"24-7:","Mobile\r$650","Ok","Cancel");
    }
    return 1;
}
Should work now.
Reply
#3

may i know the changes you did?
Reply
#4

Код:
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Welcome to driving school,", "1.Take Theory Test.\n2.Take Practical Test.", "ok","cancel");
return 1;
I removed the return 1; from that line.
Reply
#5

what difference does it make? if i enter the cp named mycp[cp] it will ignore all the codes in the other ifs right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)