Errors whilst compling
#1

Hello,
I'm trying something from the grandlarc gamemode of random spawns but I'm getting these errors when I complie.

Quote:

(172) : warning 202: number of arguments does not match definition
(172) : warning 202: number of arguments does not match definition
(172) : warning 202: number of arguments does not match definition
(173) : error 028: invalid subscript (not an array or too many subscripts): "gRandomSpawns_LosSantos"
(173) : warning 215: expression has no effect
(173) : error 001: expected token: ";", but found "]"
(173) : error 029: invalid expression, assumed zero
(173) : fatal error 107: too many error messages on one line

pawn Код:
SetPlayerPos(playerid); //line 172
        gRandomSpawns_LosSantos[randSpawn][0]; //line 173
Reply
#2


SetPlayerPos needs 4 values:
1. playerid
2. X-Coordinate
3. Y-Coordinate
4. Z-Coordinate

The line 173 makes no sence at all. "gRandomSpawns_LosSantos[randSpawn][0]" is a variable and you use it like a function. Seems weird to me.

What do you actually want to do with those code-lines?!
Reply
#3

Adjusted it to this from the grand script,

pawn Код:
SetPlayerPos(playerid,
         gRandomSpawns_LosSantos[randSpawn][0],
         gRandomSpawns_LosSantos[randSpawn][1],
         gRandomSpawns_LosSantos[randSpawn][2]);
        SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[randSpawn][3]);
    }
Reply
#4

Post the original lines, pls.
Reply
#5

Mine
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

    new randSpawn = 0;

    SetPlayerInterior(playerid,0);
    TogglePlayerClock(playerid,0);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, 30000);

    // if they ever return to class selection make them city
    // select again first
    gPlayerHasCitySelected[playerid] = 0;

    if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
      randSpawn = random(sizeof(gRandomSpawns_LosSantos));
      SetPlayerPos(playerid,
         gRandomSpawns_LosSantos[randSpawn][0],
         gRandomSpawns_LosSantos[randSpawn][1],
         gRandomSpawns_LosSantos[randSpawn][2]);
        SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[randSpawn][3]);
    }
    else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
      randSpawn = random(sizeof(gRandomSpawns_SanFierro));
      SetPlayerPos(playerid,
         gRandomSpawns_SanFierro[randSpawn][0],
         gRandomSpawns_SanFierro[randSpawn][1],
         gRandomSpawns_SanFierro[randSpawn][2]);
        SetPlayerFacingAngle(playerid,gRandomSpawns_SanFierro[randSpawn][3]);
    }
    else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
      randSpawn = random(sizeof(gRandomSpawns_LasVenturas));
      SetPlayerPos(playerid,
         gRandomSpawns_LasVenturas[randSpawn][0],
         gRandomSpawns_LasVenturas[randSpawn][1],
         gRandomSpawns_LasVenturas[randSpawn][2]);
        SetPlayerFacingAngle(playerid,gRandomSpawns_LasVenturas[randSpawn][3]);
    }


  /*SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,200);*/


    return 1;
}
grandlarc
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
   
    new randSpawn = 0;
   
    SetPlayerInterior(playerid,0);
    TogglePlayerClock(playerid,0);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, 30000);
   
    // if they ever return to class selection make them city
    // select again first
    gPlayerHasCitySelected[playerid] = 0;

    if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
      randSpawn = random(sizeof(gRandomSpawns_LosSantos));
      SetPlayerPos(playerid,
         gRandomSpawns_LosSantos[randSpawn][0],
         gRandomSpawns_LosSantos[randSpawn][1],
         gRandomSpawns_LosSantos[randSpawn][2]);
        SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[randSpawn][3]);
    }
    else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
      randSpawn = random(sizeof(gRandomSpawns_SanFierro));
      SetPlayerPos(playerid,
         gRandomSpawns_SanFierro[randSpawn][0],
         gRandomSpawns_SanFierro[randSpawn][1],
         gRandomSpawns_SanFierro[randSpawn][2]);
        SetPlayerFacingAngle(playerid,gRandomSpawns_SanFierro[randSpawn][3]);
    }
    else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
      randSpawn = random(sizeof(gRandomSpawns_LasVenturas));
      SetPlayerPos(playerid,
         gRandomSpawns_LasVenturas[randSpawn][0],
         gRandomSpawns_LasVenturas[randSpawn][1],
         gRandomSpawns_LasVenturas[randSpawn][2]);
        SetPlayerFacingAngle(playerid,gRandomSpawns_LasVenturas[randSpawn][3]);
    }

    //SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
   
    SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200);
  SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,200);
 
  GivePlayerWeapon(playerid,WEAPON_COLT45,100);
    //GivePlayerWeapon(playerid,WEAPON_MP5,100);
    //TogglePlayerClock(playerid, 1);

    return 1;
}
Reply
#6

Yes, its good like this
Reply
#7

Anyone have any idea?
Reply
#8

Quote:
Originally Posted by TheOneThatOwnZ
Anyone have any idea?
Did you do this?:
pawn Код:
//top of script
new gPlayerCitySelection[MAX_PLAYERS];
---
public OnPlayerConnect(playerid)
{
// class selection init vars
    gPlayerCitySelection[playerid] = -1;
Reply
#9

pawn Код:
new gPlayerCitySelection[MAX_PLAYERS];
new gPlayerHasCitySelected[MAX_PLAYERS];
new gPlayerLastCitySelectionTick[MAX_PLAYERS];

new gRandomSpawns_LosSantos;
new gRandomSpawns_SanFierro;
new gRandomSpawns_LasVenturas;
Reply
#10

pawn Код:
ClassSel_SetupCharSelection(playerid)
{
    if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
        SetPlayerInterior(playerid,11);
        SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
        SetPlayerFacingAngle(playerid,0.0);
    SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
        SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
    }
    else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
        SetPlayerInterior(playerid,3);
        SetPlayerPos(playerid,-2673.8381,1399.7424,918.3516);
        SetPlayerFacingAngle(playerid,181.0);
    SetPlayerCameraPos(playerid,-2673.2776,1394.3859,918.3516);
        SetPlayerCameraLookAt(playerid,-2673.8381,1399.7424,918.3516);
    }
    else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
        SetPlayerInterior(playerid,3);
        SetPlayerPos(playerid,349.0453,193.2271,1014.1797);
        SetPlayerFacingAngle(playerid,286.25);
    SetPlayerCameraPos(playerid,352.9164,194.5702,1014.1875);
        SetPlayerCameraLookAt(playerid,349.0453,193.2271,1014.1797);
    }
   
}
?

EDIT:
Make sure you have all of the code from grandlarc.pwn that includes "gPlayerCitySelection".. Did this help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)