SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/07/2019, 09:22 PM   #1
akovacevic00
Little Clucker
 
akovacevic00's Avatar
 
Join Date: May 2019
Posts: 15
Reputation: 0
Default clearing an enum

PHP Code:
enum pData
{
    
bool:IsLoggedIn,
    
LoginAttempts,
    
IPAddress[16],
    
aHide,
    
AdminPMRead,
    
StreamDND,
    
Muted,
    
PlayerVehicle,
    
gSpectateID,
    
bool:aDuty,
    
PlayerText:cWspeedo[10]
    
AimbotWarnings,
    
bool:IsFirstTimeSpawn,
    
CurrentGPCI[128],
    
pDrunkLevelLast,
    
pFPS,
    
Float:AFKPos[3],
    
AFK,
    
LastPMID,
    
pmDND,
    
bool:IsNewlyRegistered,
    
lastvehicleid
}
new 
PlayerData[MAX_PLAYERS][pData]; 


How can I clear this enum when player connects? (There are bools, floats..)
__________________
CONTACT ME
Discord: aleksandar#2233
Email: kovacevica2000@gmail.com
akovacevic00 is offline   Reply With Quote
Old 20/07/2019, 09:27 PM   #2
DomagojSellug
Big Clucker
 
DomagojSellug's Avatar
 
Join Date: Sep 2016
Location: Croatia
Posts: 178
Reputation: 9
Default Re: clearing an enum

pawn Code:
enum eEnum
{
    eVar1,
    eVar2,
    eVar3
}

new MyVar[eEnum];

//somewhere in your script
for(new i=0; i < sizeof(MyVar); i++)
{
    MyVar[eEnum:i] = 0;
}

Nasao sam to ovdje: https://forum.sa-mp.com/showthread.php?t=270773
__________________
My work:


Weapon Shop FS
Click on me!
DomagojSellug is offline   Reply With Quote
Old 21/07/2019, 07:25 AM   #3
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,019
Reputation: 115
Default Re: clearing an enum

When you want to clear it OnPlayerConnect, just overwrite the old values to new values. Why to reset them and then assign the values again?
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 21/07/2019, 08:50 AM   #4
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,922
Reputation: 258
Default Re: clearing an enum

PHP Code:
public OnPlayerDisconnect(playeridreason)
{
    new const 
reset_var[pData];

    
PlayerInfo[playerid] = reser_var;
    return 
1;

__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 21/07/2019, 01:10 PM   #5
akovacevic00
Little Clucker
 
akovacevic00's Avatar
 
Join Date: May 2019
Posts: 15
Reputation: 0
Default Re: clearing an enum

Quote:
Originally Posted by Dayrion View Post
PHP Code:
public OnPlayerDisconnect(playeridreason)
{
    new const 
reset_var[pData];

    
PlayerInfo[playerid] = reser_var;
    return 
1;



(397) : error 017: undefined symbol "reser_var"
(397) : error 033: array must be indexed (variable "UserStats")
(395) : warning 204: symbol is assigned a value that is never used: "reset_var"
__________________
CONTACT ME
Discord: aleksandar#2233
Email: kovacevica2000@gmail.com
akovacevic00 is offline   Reply With Quote
Old 21/07/2019, 10:13 PM   #6
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 598
Reputation: 66
Default Re: clearing an enum

Quote:
Originally Posted by akovacevic00 View Post
(397) : error 017: undefined symbol "reser_var"
(397) : error 033: array must be indexed (variable "UserStats")
(395) : warning 204: symbol is assigned a value that is never used: "reset_var"
@Dayrion wrote "reser_var" instead of "reset_var" so just rename the variable, obviously.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto 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
Clearing Chat AnonScripter Scripting Help 9 29/04/2014 11:49 PM
Clearing Chat RevolutionLite Scripting Help 9 25/11/2012 02:59 PM
Clearing our name. Andregood Everything and Nothing 82 06/09/2012 05:54 AM
Clearing the whole enum IgrexolonO Scripting Help 6 14/04/2012 01:19 PM
Clearing out an enum? dowster Help Archive 7 21/07/2011 05:19 PM


All times are GMT. The time now is 10:22 PM.


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