[read for details] Dialog Input skin Spawned as CJ PROBLEM! [HELP]
#1

Help! this script should worked as when player entered the server, and has been asked to put the skin ID in the box "Dialog Input"..i found that worked but, when i type "1" for The Truth Skin ID, and i spawned as CJ skin.. I tried again I put "2" and pressed confirm. but spawned as cj.. and the 3rd time i'm just typed the random word example: czdc but im spawned as cj... Help Me Pls fix this!!! Here's the code:

Код:
#include <a_samp>
#include <streamer>
#include <dudb>

#define COL_EASY           "{FFF1AF}"
#define COL_WHITE          "{FFFFFF}"
#define COL_BLACK          "{0E0101}"
#define COL_GREY           "{C3C3C3}"
#define COL_GREEN          "{6EF83C}"
#define COL_RED            "{F81414}"
#define COL_YELLOW         "{F3FF02}"
#define COL_ORANGE         "{FFAF00}"
#define COL_LIME           "{B7FF00}"
#define COL_CYAN           "{00FFEE}"
#define COL_LIGHTBLUE      "{00C0FF}"
#define COL_BLUE           "{0049FF}"
#define COL_MAGENTA        "{F300FF}"
#define COL_VIOLET         "{B700FF}"
#define COL_PINK           "{FF00EA}"
#define COL_MARONE         "{A90202}"
#define COL_CMD            "{B8FF02}"
#define COL_PARAM          "{3FCD02}"
#define COL_SERVER         "{AFE7FF}"
#define COL_VALUE 		   "{A3E4FF}"
#define COL_RULE  	   	   "{F9E8B7}"
#define COL_RULE2 		   "{FBDF89}"
#define COL_RWHITE 		   "{FFFFFF}"
#define COL_LGREEN         "{C9FFAB}"
#define COL_LRED           "{FFA1A1}"
#define COL_LRED2          "{C77D87}"

#define skin 120

new logged[MAX_PLAYERS];
new adminlevel[MAX_PLAYERS];
new money[MAX_PLAYERS];
new playername[MAX_PLAYER_NAME];

// forwards//
forward SetPlayerWorld(playerid);
forward SetPlayerWorldOpen(playerid);

main()
{
    print("===============================");
    print("");
    print("===============================");
}

public OnGameModeInit()
{
    SetGameModeText("Offline");
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetPlayerVirtualWorld(playerid,playerid+1);
    logged[playerid] = 0;
    ShowPlayerDialog(playerid, skin, DIALOG_STYLE_INPUT, "Skin Select", "Enter a skin ID below to get started", "Confirm", "Cancel");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    money[playerid] = GetPlayerMoney(playerid);
    dini_IntSet(udb_encode(playername), "money", money[playerid]);
    dini_IntSet(udb_encode(playername), "adminlevel", adminlevel[playerid]);
    dini_IntSet(udb_encode(playername), "level", GetPlayerScore(playerid));
    logged[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256],tmp[256], tmp2[256];
    new idx;
    new string[256];
    cmd = strtok(cmdtext, idx);
    GetPlayerName(playerid, playername, sizeof(playername));
    if(strcmp(cmd, "/register", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1, "USAGE: /register (password)");
        }
        else
        {
            if (!dini_Exists(udb_encode(playername)))
            {
                dini_Create(udb_encode(playername));
                dini_IntSet(udb_encode(playername), "password", udb_hash(tmp));
                dini_IntSet(udb_encode(playername), "adminlevel", 0);
                dini_IntSet(udb_encode(playername), "money", 0);
                format(string, sizeof(string), ""COL_GREEN"[ACCOUNT]: "COL_ORANGE" Account '%s' created! You can now login with /login ( existing password )", playername, tmp);
                GivePlayerMoney(playerid, 999999);
                SendClientMessage(playerid, -1, string);
            }
            else
            {
                format(string, sizeof(string), "This %s account is already registered !", playername,tmp);
                SendClientMessage(playerid, -1, string);
            }
        }
        return 1;
    }


    if(strcmp(cmd, "/login", true) == 0)
    {
        if(logged[playerid] == 1)
        {
            SendClientMessage(playerid, -1, ""COL_GREEN"[ACCOUNT]: "COL_ORANGE"You are already logged in !");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1, "[USAGE]: /login ( password )");
        }
        else
        {
            if (dini_Exists(udb_encode(playername)))
            {
                tmp2 = dini_Get(udb_encode(playername), "password");
                if (udb_hash(tmp) != strval(tmp2))
                {
                    SendClientMessage(playerid, -1, ""COL_GREEN""COL_RED"[ACCOUNT]: "COL_WHITE"Password not match !");
                }
                else
                {
                    logged[playerid] = 1;
                    money[playerid] = dini_Int(udb_encode(playername), "money");
                    adminlevel[playerid] = dini_Int(udb_encode(playername), "adminlevel");
                    format(string, sizeof(string), ""COL_GREEN"[ACCOUNT] "COL_YELLOW"you are now logged in . "COL_WHITE"You got admin level %d and have %d dollar!", adminlevel[playerid], money[playerid]);
                    SendClientMessage(playerid, -1, string);
                    GivePlayerMoney(playerid, money[playerid]);
                    SetTimerEx("SetPlayerWorld", 1000, false, "i", playerid);
                }
            }
            else
            {
                format(string, sizeof(string), ""COL_GREEN"[ACCOUNT]: "COL_RED"[SERVER]{FFFFFF}Your account are not registered yet ! "COL_YELLOW"Type /register ( password ) to create an account !", playername);
                SendClientMessage(playerid, -1, string);
            }
        }
        return 1;
    }

    if(strcmp(cmd, "/makemeadmin", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            if(logged[playerid] == 1)
            {
                if(adminlevel[playerid] != 3)
                {
                    adminlevel[playerid] = 5;
                    SendClientMessage(playerid, -1, ""COL_GREEN"[ACCOUNT]: "COL_YELLOW"You are now maxlevel admin!");
                }
                else
                {
                    SendClientMessage(playerid, -1, ""COL_GREEN"[ACCOUNT]: "COL_ORANGE"You are already maxlevel admin!");
                }
            }
            else
            {
                SendClientMessage(playerid, -1, ""COL_GREEN"[ACCOUNT]: {FFFFFF}Please, first login: /login [password]");
            }
        }
        else
        {
            SendClientMessage(playerid, -1, ""COL_GREEN"[ACCOUNT]: "COL_ORANGE"You must first login with rcon ! {FFFFFF}(/rcon login ( rcon-pass )");
        }
		return 1;
	}
	return 0;

}

public OnPlayerSpawn(playerid)
{
    if(logged[playerid] == 0)
    {
        SendClientMessage(playerid, -1, ""COL_GREEN"[ACCOUNT]: {FFFFFF}You are not logged in yet. USAGE: Use /login (password)");
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
	return 1;
}

public SetPlayerWorld(playerid)
{
	 GameTextForPlayer(playerid," Loading Server Virtualworld...",5000,5);
	 TogglePlayerControllable(playerid,0);
	 SetPlayerVirtualWorld(playerid,0);
     SetTimerEx("SetPlayerWorldOpen", 3000, false, "i", playerid);
}

public SetPlayerWorldOpen(playerid)
{
    TogglePlayerControllable(playerid,1);
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == skin)
    {
        if(response)
        {
            new skinid, message[64];
            skinid = strval(inputtext);
            if(skinid < 0 || skinid > 299)
            {
                SendClientMessage(playerid, 0x33FF33AA, "Error: Choose a skin ID between 0 and 299.");
                Kick(playerid);
            }
            else
            {
                format(message, sizeof(message), "You have successfully changed your skin id to %d.", skinid);
                SendClientMessage(playerid, 0x33FF33AA, message);
                SetSpawnInfo(playerid,0,skinid,2239.723, -1261.922, 23.9375,270.7165,0,0,0,0,0,0);
                SpawnPlayer(playerid);
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
Reply
#2

Is there any skin with id 0? Just try changing 0 with 1..

skinid < 1
Reply
#3

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
Is there any skin with id 0? Just try changing 0 with 1..

skinid < 1
Doesn't work... still spawned as Cj skin...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)