SA-MP Forums Archive
2 things i need someone help me please.... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 things i need someone help me please.... (/showthread.php?tid=74034)



2 things i need someone help me please.... - WardenCS - 19.04.2009

there is an countdown command,i want to make it like only those players see who are close to him who make /count
so command are here : can someone chanbge it to like that?

Quote:

public countdown()
{
if(cd_sec == 0)
{
GameTextForAll("~r~Go!",1000,3);
KillTimer(cd_timer);
}
else
{
new string[8];
format(string,sizeof(string),"~g~%d",cd_sec);
GameTextForAll(string,1000,3);
}
cd_sec = cd_sec-1;
return 1;
}

and there are
Quote:

if(strcmp(cmd,"/count",true)==0)
{
cd_sec = 5;
cd_timer = SetTimer("countdown", 999, 1);
return true;
}

and other one is login thing,if you register like : register lalal , you have to login with : register lalal,can someone fix that and make like u can enter ur password with register lalal login lalal and just lalal

heres the code:



Quote:

public OnPlayerLogin(playerid,password[])
{
new string2[128];
format(string2, sizeof(string2), "JRP_Scriptfiles/Accounts/%s.ini", PlayerName(playerid));
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "DonateRank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonateRank] = strval( val ); }
if( strcmp( key , "Registered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRegistered] = strval( val ); }
if( strcmp( key , "Sex" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSex] = strval( val ); }
if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val ); }
if( strcmp( key , "Experience" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
if( strcmp( key , "Drugs" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDrugs] = strval( val ); }
if( strcmp( key , "Materials" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMaterials] = strval( val ); }
if( strcmp( key , "Job" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJob] = strval( val ); }
if( strcmp( key , "PlayingHours" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPlayingHours] = strval( val ); }
if( strcmp( key , "AllowedPayday" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAllowedPayday] = strval( val ); }
if( strcmp( key , "PayCheck" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPayCheck] = strval( val ); }
if( strcmp( key , "Faction" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFaction] = strval( val ); }
if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
if( strcmp( key , "HouseKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHouseKey] = strval( val ); }
if( strcmp( key , "BizKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBizKey] = strval( val ); }
if( strcmp( key , "SpawnPoint" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawnPoint] = strval( val ); }
if( strcmp( key , "Banned" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanned] = strval( val ); }
if( strcmp( key , "Warnings" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarnings] = strval( val ); }
if( strcmp( key , "CarLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarLic] = strval( val ); }
if( strcmp( key , "FlyLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFlyLic] = strval( val ); }
if( strcmp( key , "WepLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWepLic] = strval( val ); }
if( strcmp( key , "PhoneNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneNumber] = strval( val ); }
if( strcmp( key , "PhoneC" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneC] = strval( val ); }
if( strcmp( key , "PhoneBook" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneBook] = strval( val ); }
if( strcmp( key , "ListNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pListNumber] = strval( val ); }
if( strcmp( key , "Donator" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonator] = strval( val ); }
if( strcmp( key , "Jailed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailed] = strval( val ); }
if( strcmp( key , "JailTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailTime] = strval( val ); }
if( strcmp( key , "Products" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pProducts] = strval( val ); }
if( strcmp( key , "CrashX" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashX] = floatstr( val ); }
if( strcmp( key , "CrashY" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashY] = floatstr( val ); }
if( strcmp( key , "CrashZ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashZ] = floatstr( val ); }
if( strcmp( key , "CrashInt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashInt] = strval( val ); }
if( strcmp( key , "CrashW" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashW] = strval( val ); }
if( strcmp( key , "Crashed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashed] = strval( val ); }
}
fclose(UserFile);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Incorrect password!");
fclose(UserFile);
return 1;
}
if(PlayerInfo[playerid][pFaction] != 255)
{
if(DynamicFactions[PlayerInfo[playerid][pFaction]][fUseColor])
{
SetPlayerToFactionColor(playerid);
}
}
else
{
SetPlayerColor(playerid,COLOR_CIVILIAN);
}
if(PlayerInfo[playerid][pBanned])
{
KickPlayer(playerid,"System","Account Banned.");
}
if(PlayerInfo[playerid][pRegistered] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pCash] = 2500;
PlayerInfo[playerid][pBank] = 7500;
PlayerInfo[playerid][pSkin] = 200;
SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[INFO:] You have not yet set your age, set it now by typing ages between 16-100.");
RegistrationStep[playerid] = 1;
}
SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
SendClientMessage(playerid, COLOR_YELLOW2, "[INFO:] Successfully logged in.");
gPlayerLogged[playerid] = 1;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],CivilianSpawn[X],CivilianSpawn[Y],CivilianSpawn[Z],0,0,0,0,0,0,0);
SpawnPlayer(playerid);
}
return 1;
}




Re: 2 things i need someone help me please.... - kingcesar - 19.04.2009

Quote:
Originally Posted by WardenCS

and other one is login thing,if you register like : register lalal , you have to login with : register lalal,can someone fix that and make like u can enter ur password with register lalal login lalal and just lalal

heres the code:



Quote:

public OnPlayerLogin(playerid,password[])
{
new string2[128];
format(string2, sizeof(string2), "JRP_Scriptfiles/Accounts/%s.ini", PlayerName(playerid));
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "DonateRank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonateRank] = strval( val ); }
if( strcmp( key , "Registered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRegistered] = strval( val ); }
if( strcmp( key , "Sex" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSex] = strval( val ); }
if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val ); }
if( strcmp( key , "Experience" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
if( strcmp( key , "Drugs" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDrugs] = strval( val ); }
if( strcmp( key , "Materials" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMaterials] = strval( val ); }
if( strcmp( key , "Job" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJob] = strval( val ); }
if( strcmp( key , "PlayingHours" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPlayingHours] = strval( val ); }
if( strcmp( key , "AllowedPayday" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAllowedPayday] = strval( val ); }
if( strcmp( key , "PayCheck" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPayCheck] = strval( val ); }
if( strcmp( key , "Faction" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFaction] = strval( val ); }
if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
if( strcmp( key , "HouseKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHouseKey] = strval( val ); }
if( strcmp( key , "BizKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBizKey] = strval( val ); }
if( strcmp( key , "SpawnPoint" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawnPoint] = strval( val ); }
if( strcmp( key , "Banned" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanned] = strval( val ); }
if( strcmp( key , "Warnings" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarnings] = strval( val ); }
if( strcmp( key , "CarLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarLic] = strval( val ); }
if( strcmp( key , "FlyLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFlyLic] = strval( val ); }
if( strcmp( key , "WepLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWepLic] = strval( val ); }
if( strcmp( key , "PhoneNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneNumber] = strval( val ); }
if( strcmp( key , "PhoneC" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneC] = strval( val ); }
if( strcmp( key , "PhoneBook" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneBook] = strval( val ); }
if( strcmp( key , "ListNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pListNumber] = strval( val ); }
if( strcmp( key , "Donator" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonator] = strval( val ); }
if( strcmp( key , "Jailed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailed] = strval( val ); }
if( strcmp( key , "JailTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailTime] = strval( val ); }
if( strcmp( key , "Products" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pProducts] = strval( val ); }
if( strcmp( key , "CrashX" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashX] = floatstr( val ); }
if( strcmp( key , "CrashY" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashY] = floatstr( val ); }
if( strcmp( key , "CrashZ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashZ] = floatstr( val ); }
if( strcmp( key , "CrashInt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashInt] = strval( val ); }
if( strcmp( key , "CrashW" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashW] = strval( val ); }
if( strcmp( key , "Crashed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashed] = strval( val ); }
}
fclose(UserFile);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Incorrect password!");
fclose(UserFile);
return 1;
}
if(PlayerInfo[playerid][pFaction] != 255)
{
if(DynamicFactions[PlayerInfo[playerid][pFaction]][fUseColor])
{
SetPlayerToFactionColor(playerid);
}
}
else
{
SetPlayerColor(playerid,COLOR_CIVILIAN);
}
if(PlayerInfo[playerid][pBanned])
{
KickPlayer(playerid,"System","Account Banned.");
}
if(PlayerInfo[playerid][pRegistered] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pCash] = 2500;
PlayerInfo[playerid][pBank] = 7500;
PlayerInfo[playerid][pSkin] = 200;
SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[INFO:] You have not yet set your age, set it now by typing ages between 16-100.");
RegistrationStep[playerid] = 1;
}
SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
SendClientMessage(playerid, COLOR_YELLOW2, "[INFO:] Successfully logged in.");
gPlayerLogged[playerid] = 1;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],CivilianSpawn[X],CivilianSpawn[Y],CivilianSpawn[Z],0,0,0,0,0,0,0);
SpawnPlayer(playerid);
}
return 1;
}

I didn't understand, what's your request


Re: 2 things i need someone help me please.... - WardenCS - 19.04.2009

can someone make it like you can login with when ur start are right at password i mean like u got password sexy,when u want login u can login with:login sexy , register sexy,and just sexy


Re: 2 things i need someone help me please.... - Francis[French] - 19.04.2009


Hi there,

Do you mean that there would be three ways to login? /register [pass] /login [pass] and /[pass]?

If yes, that's stupid as if an user wants his password to be an important command, such as /kill, he wouldn't be able to kill himself because it would be saying he is already logged in. But it's indeed possible. If you still want support, I'll go further and help.

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com


Re: 2 things i need someone help me please.... - WardenCS - 19.04.2009

hello??


Re: 2 things i need someone help me please.... - Francis[French] - 19.04.2009

Quote:
Originally Posted by WardenCS
hello??
Quote:
Originally Posted by [SAP
Francis ]

Hi there,

Do you mean that there would be three ways to login? /register [pass] /login [pass] and /[pass]?

If yes, that's stupid as if an user wants his password to be an important command, such as /kill, he wouldn't be able to kill himself because it would be saying he is already logged in. But it's indeed possible. If you still want support, I'll go further and help.

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com



Re: 2 things i need someone help me please.... - WardenCS - 19.04.2009

my server cant use commands before u log in...u have to write without /


Re: 2 things i need someone help me please.... - Francis[French] - 19.04.2009

Hi there,

A simple check in OnPlayerText would do it good then.

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com


Re: 2 things i need someone help me please.... - WardenCS - 19.04.2009

where i add this?


Re: 2 things i need someone help me please.... - WardenCS - 19.04.2009

cool francis pls tell me