Spawn Location
#1

Hello i want to know how to spawn the player which is register just now and enter the game first time at fix position . Give me the code i will add my AddPlayerClass and how to set spawn position to his last position when he logs in again . I am using SqlLite for player info.
Reply
#2

enum playerdata
{
pRegistered,
pPos[3]
}

OnPlayerSpawn(playerid)
{
if(PlayerData[playerid][pRegistered] = 0)
{
SetPlayerPos(playerid, x, y, z); // pick these
}
if(PlayerData[playerid][pRegistered] = 1)
{
SetPlayerPos(playerid, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
}
return 1;
}

Under OnPlayerDisconnect add
GetPlayerPos(playerid, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
Reply
#3

Facing the following errors.

Код:
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(671) : error 028: invalid subscript (not an array or too many subscripts): "PlayerData"
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(671) : warning 215: expression has no effect
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(671) : error 001: expected token: ";", but found "]"
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(671) : error 029: invalid expression, assumed zero
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(671) : fatal error 107: too many error messages on one line
Reply
#4

show ur enums
Reply
#5

My bad add this at the bottom of the playerdata enum

pPos[3]
}; <<<

Rep+ appreciated man.
Reply
#6

Stunn23 , here is my enum.
PHP код:
enum PlayerInfo
{
    
accountID,
    
accountName[24],
    
accountIP[20],
    
accountPassword[129],
    
accountAdmin,
    
accountKills,
    
accountDeaths,
    
accountScore,
    
accountCash,
    
boolaccountLogged
}; 
Divergent i will if you solve it . Check out the following .

Errors:
Код:
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(686) : error 028: invalid subscript (not an array or too many subscripts): "PlayerData"
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(686) : warning 215: expression has no effect
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(686) : error 001: expected token: ";", but found "]"
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(686) : error 029: invalid expression, assumed zero
C:\Users\Arsalan\Desktop\Samp\gamemodes\jadmin3.pwn(686) : fatal error 107: too many error messages on one line
Line no 686:
PHP код:
if(PlayerData[playerid][pRegistered] = 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)