Random spawn need help
#1

#include <a_samp>
#include <core>
#include <float>
#include <a_players>

#pragma tabsize 0

new Float:RandomSpawn[][4] = {
{297.0665,-1149.0099,85.1389,146.4700},
{293.2118,-1138.4779,85.1250,205.0405},
{299.8486,-1154.1123,81.3728,171.4901},
{325.2620,-1143.8159,81.5934,223.8173},
{316.0294,-1139.3528,81.5934,309.0682},
{311.2324,-1121.3932,80.9141,136.7566}
};

public OnGameModeInit()
{
SetGameModeText("0.3b R2");
AddPlayerClass(115,2048.9133,-2448.0999,17.8742,268.2145,0,0,0,0,0,0);
return 1;
}

public OnPlayerSpawn(playerid)
{
new rand = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);

return 1;
}


and the error report is
-error 017: undefined symbol "RandomSpawn"
-error 029: invalid expression, assumed zero
-warning 215: expression has no effect
-error 017: undefined symbol "RandomSpawn"
-warning 215: expression has no effect
-expected token: ";", but found "]"
-invalid expression, assumed zero
-fatal error 107: too many error messages on one line
Reply
#2

pawn Код:
#include <a_samp> // SA-MP includes all (or most) of those includes automatically now.
//#include <core>
//#include <float>
//#include <a_players>


new Float:RandomSpawn[6][4] = {
{297.0665,-1149.0099,85.1389,146.4700},
{293.2118,-1138.4779,85.1250,205.0405},
{299.8486,-1154.1123,81.3728,171.4901},
{325.2620,-1143.8159,81.5934,223.8173},
{316.0294,-1139.3528,81.5934,309.0682},
{311.2324,-1121.3932,80.9141,136.7566}
};

public OnGameModeInit()
{
    SetGameModeText("0.3b R2");
    AddPlayerClass(115,2048.9133,-2448.0999,17.8742,268.2145,0,0,0,0,0,0);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new rand = random(sizeof(RandomSpawn));
    SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
    return 1;
}
Try that, and try refrain from using '#pragma tabsize' unless it's completely necessary. (my compiler disregarded the errors and failed to spit any out when I compiled your code so I'm unsure if this is error-free)
Reply
#3

i fixed it ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)