Storing in a ENUM interfears with another enum
#1

Hello.

My enum Player[playerid][Nick] get's corrupted once i store float in this enums.
This is so weird, because i am nowhere near this command storing something in the nick.
PHP Code:
    new Float:ox,Float:oy,Float:oz,Float:oa;
    
GetPlayerPos(playerid,ox,oy,oz);
    
GetPlayerFacingAngle(playerid,oa);
    
Player[playerid][Oldx] = ox;
    
Player[playerid][Oldy] = oy;
    
Player[playerid][Oldz] = oz;
    
Player[playerid][Olda] = oa
even tho its nowhere to be found in the code.
Did i do something wrong?



Here is my debug code to test where it is:
PHP Code:
COMMAND:tpto(playeridparams[]) {
    if(!
Player[playerid][Authed] || Player[playerid][Admin] && Player[playerid][Helper]) return SendClientError(playerid"You are not authorised to use this command.");
    new 
target;
    if(
Player[playerid][Helper] && !Player[playerid][HelperDuty]) return SendClientError(playerid,"You arn't on helper duty.");
    if(
sscanf(params"u"target)) return SendClientUsage(playerid"/tpto [playerid]");
    if(!
IsPlayerConnected(target)) return SendClientError(playerid"That player isn't connected.");
    
SendClientMessage(playerid,-1,sprintf("%s",Player[playerid][Nick]));
    new 
Float:ox,Float:oy,Float:oz,Float:oa;
    
GetPlayerPos(playerid,ox,oy,oz);
    
GetPlayerFacingAngle(playerid,oa);
    
Player[playerid][Oldx] = ox;
    
Player[playerid][Oldy] = oy;
    
Player[playerid][Oldz] = oz;
    
Player[playerid][Olda] = oa;
    
SendClientMessage(playerid,-1,sprintf("%s",Player[playerid][Nick]));
     new 
Float:xFloat:yFloat:zGetPlayerPos(targetxyz);
     if(
IsPlayerInAnyVehicle(playerid))
     {
    new 
vid GetPlayerVehicleID(playerid);
     
SetVehiclePos(vidx+3,y,z);
    
SetVehicleVirtualWorld(vidGetPlayerVirtualWorld(target));
    
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(target));
     }
    else
    {
    
SetPlayerPos(playeridx+1.5yz);
    
SetPlayerInterior(playeridGetPlayerInterior(target));
    
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(target));
    }
    
SendClientMessage(playerid,-1,sprintf("%s",Player[playerid][Nick]));
    
IRC_GroupSay(Group"#adminlogs"sprintf("%s tp'ed to %s."RPName(playerid), RPName(target)));
     return 
1;

What it outputs:

Trace is the correct loading for it.
Reply
#2

In you're Enum, Make sure you float the variables.

PHP Code:
Float:ox
Float
:oy
Float
:oz
Float
:oa 
Show us your enum, if you already did it.
Reply
#3

Quote:
Originally Posted by DarkSkull
View Post
In you Enum, Make sure you float the variables

PHP Code:
Float:ox
Float
:oy
Float
:oz
Float
:oa 
Ofcourse i have that
thanks for thinking anyways
Reply
#4

Quote:

GetPlayerPos(playerid, Player[playerid][Oldx], Player[playerid][Oldy], Player[playerid][Oldz]);
GetPlayerFacingAngle(playerid, Player[playerid][Olda]);

Instead

Quote:

new Floatx,Floaty,Floatz,Floata;
GetPlayerPos(playerid,ox,oy,oz);
GetPlayerFacingAngle(playerid,oa);
Player[playerid][Oldx] = ox;
Player[playerid][Oldy] = oy;
Player[playerid][Oldz] = oz;
Player[playerid][Olda] = oa;

Reply
#5

Quote:
Originally Posted by N3cromancer
View Post
Instead
Still overwrites the Nick enum
Reply
#6

Can you show us your Enums
Reply
#7

Quote:
Originally Posted by DarkSkull
View Post
Can you show us your Enums
PHP Code:
enum PlayerInfo {
    
Authed,
    
Nametag,
    
Nick,
    
Float:Oldx,
    
Float:Oldy,
    
Float:Oldz,
    
Float:Olda,
    
Password[256],
    
QuickLogin,
    
Sex,
    
Admin,
    
AdminDuty,
    
Helper,
    
HelperDuty,
    
Money,
    
BankMoney,
    
Level,
    
Points,
    
PayTime,
    
Skin,
    
Target,
    
Jail,
    
JailTimer,
    
HelpRequest[144],
    
HelpRequestAnswer,
    
Tutorial,
    
TutorialCount
}
new 
Player[MAX_PLAYERS][PlayerInfo]; 
Reply
#8

Nick need be string change Nick to Nick[MAX_PLAYER_NAME] in the Enum.
Reply
#9

Try changing: Nick to Nick[MAX_PLAYER_NAME]
Reply
#10

Quote:
Originally Posted by DarkSkull
View Post
Try changing: Nick to Nick[MAX_PLAYER_NAME]
Why didnt i give Nick a string size..........
i must be sleeping
thanks

love



<3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)