SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/08/2016, 06:49 AM   #1
justjamie
Huge Clucker
 
Join Date: May 2014
Posts: 424
Reputation: 5
Default Storing in a ENUM interfears with another enum

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.
justjamie is offline   Reply With Quote
Old 14/08/2016, 07:07 AM   #2
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 325
Reputation: 43
Default Re: Storing in a ENUM interfears with another enum

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.
DarkSkull is offline   Reply With Quote
Old 14/08/2016, 07:08 AM   #3
justjamie
Huge Clucker
 
Join Date: May 2014
Posts: 424
Reputation: 5
Default Re: Storing in a ENUM interfears with another enum

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
justjamie is offline   Reply With Quote
Old 14/08/2016, 07:11 AM   #4
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Re: Storing in a ENUM interfears with another enum

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;
N3cromancer is offline   Reply With Quote
Old 14/08/2016, 07:13 AM   #5
justjamie
Huge Clucker
 
Join Date: May 2014
Posts: 424
Reputation: 5
Default Re: Storing in a ENUM interfears with another enum

Quote:
Originally Posted by N3cromancer View Post
Instead
Still overwrites the Nick enum
justjamie is offline   Reply With Quote
Old 14/08/2016, 07:13 AM   #6
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 325
Reputation: 43
Default Re: Storing in a ENUM interfears with another enum

Can you show us your Enums
DarkSkull is offline   Reply With Quote
Old 14/08/2016, 07:15 AM   #7
justjamie
Huge Clucker
 
Join Date: May 2014
Posts: 424
Reputation: 5
Default Re: Storing in a ENUM interfears with another enum

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]; 
justjamie is offline   Reply With Quote
Old 14/08/2016, 07:16 AM   #8
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Re: Storing in a ENUM interfears with another enum

Nick need be string change Nick to Nick[MAX_PLAYER_NAME] in the Enum.
N3cromancer is offline   Reply With Quote
Old 14/08/2016, 07:18 AM   #9
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 325
Reputation: 43
Default Re: Storing in a ENUM interfears with another enum

Try changing: Nick to Nick[MAX_PLAYER_NAME]
DarkSkull is offline   Reply With Quote
Old 14/08/2016, 07:20 AM   #10
justjamie
Huge Clucker
 
Join Date: May 2014
Posts: 424
Reputation: 5
Default Re: Storing in a ENUM interfears with another enum

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
justjamie is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with enum, and storing Sc0pion Scripting Help 3 16/07/2015 06:10 AM
Pawn: enum type in enum sagosagi1 Scripting Help 6 19/05/2014 08:34 AM
Multiple instances of an enum inside an enum Enforcer501 Scripting Help 4 18/06/2013 02:31 PM
Enum tag inside another enum? LarzI Scripting Help 4 19/03/2013 02:10 PM


All times are GMT. The time now is 06:53 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.