Posts: 366
Threads: 113
Joined: Feb 2014
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.
Posts: 161
Threads: 2
Joined: Nov 2014
Reputation:
0
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]);
Posts: 366
Threads: 113
Joined: Feb 2014
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
Posts: 161
Threads: 2
Joined: Nov 2014
Reputation:
0
My bad add this at the bottom of the playerdata enum
pPos[3]
}; <<<
Rep+ appreciated man.
Posts: 366
Threads: 113
Joined: Feb 2014
Stunn23 , here is my enum.
PHP код:
enum PlayerInfo
{
accountID,
accountName[24],
accountIP[20],
accountPassword[129],
accountAdmin,
accountKills,
accountDeaths,
accountScore,
accountCash,
bool: accountLogged
};
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)