ifScore
#1

I dont know where the problem..
If i have more than 15 XP it should write Accepted
if lower than 15 Need More XP.
I cant understand why it bugs..

pawn Код:
#include <a_samp>

new PlayerScore;
new pickupas;
public OnGameModeInit()
{
    pickupas = CreatePickup(1314, 2, 2026.5564, 1344.3346, 10.8203, -1);
    return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
   if(pickupid == pickupas)
{
   ShowPlayerDialog(playerid, pickupas, DIALOG_STYLE_LIST, "{FFFFFF}JOB", "{FFFF00}Take Job\n{FFFF00}Leave Job", "OK", "Cancel");
}
   return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == pickupas)
        {
        if(response)
        {
        if(listitem == 0)
        {
        if(PlayerScore <= 15)
        {
        SendClientMessage(playerid, -1, "Accepted");
        }else{SendClientMessage(playerid, -1, "Need more XP.");}
        }
        }
        }
        return 1;
}
Reply
#2

PlayerScore is always 0, use GetPlayerScore instead. You used if the score is lesser or equal to 15 to be accepted when you wanted the opposite. Also use another dialogid, don't use the ID of the pickup for it.

pawn Код:
#include <a_samp>

new pickupas;

public OnGameModeInit()
{
    pickupas = CreatePickup(1314, 2, 2026.5564, 1344.3346, 10.8203, -1);
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == pickupas) ShowPlayerDialog(playerid, 412, DIALOG_STYLE_LIST, "{FFFFFF}JOB", "{FFFF00}Take Job\n{FFFF00}Leave Job", "OK", "Cancel");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 412:
        {
            if(response && !listitem)
            {
                if(GetPlayerScore(playerid) >= 15) SendClientMessage(playerid, -1, "Accepted");
                else SendClientMessage(playerid, -1, "Need more XP.");
            }
            return 1;
        }
    }
    return 0;
}
Reply
#3

You never assigned a value to PlayerScore, therefore it is always assumed 0.

Remove
pawn Код:
new PlayerScore;
And Replace this:
pawn Код:
if(PlayerScore <= 15)
With:
pawn Код:
if(GetPlayerScore(playerid) <= 15)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)