SA-MP Forums Archive
spawn choosing - 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: spawn choosing (/showthread.php?tid=216340)



spawn choosing - Reezmi - 25.01.2011

hi. i haz a question.
how i can make spawn choosing like grandlarency?
i tried from grandlarency code:

pawn Код:
ClassSel_SwitchToNextCity(playerid)
{
    gPlayerCitySelection[playerid]++;
    if(gPlayerCitySelection[playerid] > CITY_LAS_VENTURAS) {
        gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
    }
    PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
    gPlayerLastCitySelectionTick[playerid] = GetTickCount();
    ClassSel_SetupSelectedCity(playerid);
}

//----------------------------------------------------------

ClassSel_SwitchToPreviousCity(playerid)
{
    gPlayerCitySelection[playerid]--;
    if(gPlayerCitySelection[playerid] < CITY_LOS_SANTOS) {
        gPlayerCitySelection[playerid] = CITY_LAS_VENTURAS;
    }
    PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
    gPlayerLastCitySelectionTick[playerid] = GetTickCount();
    ClassSel_SetupSelectedCity(playerid);
}
and here is my edited code:

pawn Код:
ClassSel_SwitchToNextSpawn(playerid)
{
    gPlayerSpawnSelection[playerid]++;
    if(gPlayerSpawnSelection[playerid] > SPAWN_FARMER) {
        gPlayerSpawnSelection[playerid] = SPAWN_SECURITY;
    }
    if(gPlayerSpawnSelection[playerid] > SPAWN_MEDIC) {
        gPlayerSpawnSelection[playerid] = SPAWN_FARMER;
    }
    else if(gPlayerSpawnSelection[playerid] > SPAWN_GUN_DEALER) {
        gPlayerSpawnSelection[playerid] = SPAWN_MEDIC;
    }
    else if(gPlayerSpawnSelection[playerid] > SPAWN_POLICE) {
        gPlayerSpawnSelection[playerid] = SPAWN_GUN_DEALER;
    }
    else if(gPlayerSpawnSelection[playerid] > SPAWN_RACER) {
        gPlayerSpawnSelection[playerid] = SPAWN_POLICE;
    }
    PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
    gPlayerLastSpawnSelectionTick[playerid] = GetTickCount();
    ClassSel_SetupSelectedSpawn(playerid);
}

ClassSel_SwitchToPreviousSpawn(playerid)
{
    gPlayerSpawnSelection[playerid]--;
    if(gPlayerSpawnSelection[playerid] < SPAWN_SECURITY) {
        gPlayerSpawnSelection[playerid] = SPAWN_FARMER;
    }
    else if(gPlayerSpawnSelection[playerid] < SPAWN_FARMER) {
        gPlayerSpawnSelection[playerid] = SPAWN_MEDIC;
    }
    else if(gPlayerSpawnSelection[playerid] < SPAWN_MEDIC) {
        gPlayerSpawnSelection[playerid] = SPAWN_GUN_DEALER;
    }
    else if(gPlayerSpawnSelection[playerid] < SPAWN_GUN_DEALER) {
        gPlayerSpawnSelection[playerid] = SPAWN_POLICE;
    }
    else if(gPlayerSpawnSelection[playerid] < SPAWN_POLICE) {
        gPlayerSpawnSelection[playerid] = SPAWN_RACER;
    }
    PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
    gPlayerLastSpawnSelectionTick[playerid] = GetTickCount();
    ClassSel_SetupSelectedSpawn(playerid);
}
but it worked shitty so response please if you know how to fix this.
and i need to work it smth like OnPlayerRequestClass.