onplayerspawn sees the first thing in the callback, and skips the rest -_-
#1

hey everyone,

i made it that when a player comes at classselection, he can choose drift world and stunt world, but the problem is, when at spawning, it retrieves the info it has saved at ondialogresponse, which is StuntWorld if player did stuntworld, and DriftWorld if player selected driftworld,
but now at the onplayerspawn, i found out it only does the first one it sees
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][World] == DriftWorld)
    {
        new skin;
        new file[300];
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(file,sizeof(file),"nAdmin/Users/%s.ini",name);
        skin = dini_Int(file, "Skin");
        SetPlayerSkin(playerid, skin);
        new Rand = random(sizeof(RandomSpawnsDriftWorld));
        SetPlayerPos(playerid, RandomSpawnsDriftWorld[Rand][0], RandomSpawnsDriftWorld[Rand][1], RandomSpawnsDriftWorld[Rand][2]);
        SetPlayerInterior(playerid, 0);
        SetWorld(playerid, "DriftWorld");
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Environment to load",2000,3);
        SendClientMessage(playerid, COLOR_WHITE, "Spawned at random drift places");
    }
    else if(PlayerInfo[playerid][World] == StuntWorld)
    {
        new skin;
        new file[300];
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(file,sizeof(file),"nAdmin/Users/%s.ini",name);
        skin = dini_Int(file, "Skin");
        SetPlayerSkin(playerid, skin);
        new Random = random(sizeof(RandomSpawnsStuntWorld));
        SetPlayerPos(playerid, RandomSpawnsStuntWorld[Random][0], RandomSpawnsStuntWorld[Random][1], RandomSpawnsStuntWorld[Random][2]);
        SetPlayerInterior(playerid, 0);
        SetWorld(playerid, "StuntWorld");
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Environment to load",2000,3);
        SendClientMessage(playerid, COLOR_WHITE, "Spawned at random stunt places");
    }
    return 1;
}
so here it picks the driftworld as first, and skips the stunt world...

if i change the things, and put stuntworld in front and driftworld under it, it picks stuntworld, and skips driftworld...

anyone knows how to make it that it WILL select the selected world, instead of just picking the first one it sees?

greets niels
Reply
#2

pawn Код:
new StuntWorld, DriftWorld, DriftWorldID = 1, StuntWorldID = 2;
pawn Код:
enum pInfo
{
    AdminLevel,
    VipLevel,
    cash,
    score,
    currentcar,
    CheckPointID,
    bool:IsFreeRoaming,
    Speed,
    Muted,
    Banned,
    BonnetOpen,
    SpecialNos,
    Warns,
    GoesInVehicle,
    TickCount,
    SpeedTest,
    Lights,
    Engine,
    BootOpen,
    Ip[16],
    Float:SFloatX,
    Float:SFloatY,
    Float:SFloatZ,
    Float:airbrkxcoord,
    Float:airbrkycoord,
    Float:airbrkzcoord,
    World
}
pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
stock SetWorld(playerid, world[])
{
    if(!strcmp(world, "DriftWorld", true)) //Kijken of de naam klopt
    {
        PlayerInfo[playerid][World] = DriftWorld;
        SetPlayerVirtualWorld(playerid, DriftWorldID);
        SendClientMessage(playerid, COLOR_WHITE, "SetWorld = DriftWorld");
    }
    else if(!strcmp(world, "StuntWorld", true))
    {
        PlayerInfo[playerid][World] = StuntWorld;
        SetPlayerVirtualWorld(playerid, StuntWorldID);
        SendClientMessage(playerid, COLOR_WHITE, "SetWorld = StuntWorld");
    }
    return 1;
}
pawn Код:
// the dialog it shows at requestclass
if(dialogid == DIALOG_WORLDS)
    {
        switch(listitem)
        {
            case 0:
            {
                PlayerInfo[playerid][World] = DriftWorld;
                SendClientMessage(playerid, COLOR_WHITE, "Picked DriftWorld");
            }
            case 1:
            {
                PlayerInfo[playerid][World] = StuntWorld;
                SendClientMessage(playerid, COLOR_WHITE, "Picked StuntWorld");
            }
        }
    }
wuts wrong with this?
Reply
#3

Shouldn't you be setting the player world variable to one of these?
pawn Код:
new DriftWorldID = 1;
new StuntWorldID = 2;
instaid of the other variables you are using. What I see is that you are setting the player variable to a non-existing value.
Reply
#4

it works ty i setted the variables to 1 and 2 like you said ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)