SA-MP Forums Archive
Whats wrong here? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong here? (/showthread.php?tid=186127)



Whats wrong here? - Luis- - 27.10.2010

Well I made a Dialog for OnPlayerRequestSpawn and when a player selects a certain skin the Dialog shows but it doesn't.

pawn Код:
if (dialogid == 20)
    {
        if(response)
        {
            new message[256+1];
            if(listitem == 0)
            {
            format(message, 256, "You have selected Los Santos Airport!", listitem);
            SendClientMessage(playerid, 0xFFFFFFFF, message);
            SetPlayerPos(playerid, 1895.2489,-2333.6741,13.5469);
            }
        }
    }
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if (gTeam[playerid] == TEAM_PILOT)
    {
        switch(GetPlayerTeam(GetPlayerSkin(playerid)))
        {
            case 17, 57, 61, 163, 164, 165, 166, 187:
            {
               ShowPlayerDialog(playerid, 20, DIALOG_STYLE_LIST, "Pilot's Spawn Point", "Los Santos Airport\nSan Fierro Airport\nLas Venturas Airport", "Select", "Cancel");
            }
        }
    }
    return 1;
}



Re: Whats wrong here? - MadeMan - 27.10.2010

pawn Код:
switch(GetPlayerTeam(GetPlayerSkin(playerid)))
Why you have GetPlayerTeam in there?


Re: Whats wrong here? - Luis- - 27.10.2010

So it finds the player team , Or is it wrong?


Re: Whats wrong here? - Calgon - 27.10.2010

This does not relate to your problem, however it does address a serious flaw in your coding.

pawn Код:
if (dialogid == 20)
    {
        if(response)
        {
            new message[256+1];
            if(listitem == 0)
            {
            format(message, 256, "You have selected Los Santos Airport!", listitem);
            SendClientMessage(playerid, 0xFFFFFFFF, message);
            SetPlayerPos(playerid, 1895.2489,-2333.6741,13.5469);
            }
        }
    }
Why have you created a string with the size of 257. You do not even use format to properly add any strings. You can simply add a client message without any formatting. Even so, the limit for chat messages is 128, not 256, not 257, the limit is 128.

https://sampforum.blast.hk/showthread.php?tid=55261


Re: Whats wrong here? - MadeMan - 27.10.2010

Quote:
Originally Posted by -Luis
Посмотреть сообщение
So it finds the player team , Or is it wrong?
I think it is wrong.

If you want to show the dialog for a certain skin, then just

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    switch(GetPlayerSkin(playerid))
    {
        case 17, 57, 61, 163, 164, 165, 166, 187:
        {
            ShowPlayerDialog(playerid, 20, DIALOG_STYLE_LIST, "Pilot's Spawn Point", "Los Santos Airport\nSan Fierro Airport\nLas Venturas Airport", "Select", "Cancel");
        }
    }
    return 1;
}



Re: Whats wrong here? - Luis- - 27.10.2010

Thanks, It worked!