SA-MP Forums Archive
register when the player tape /joueuralpha - 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)
+--- Thread: register when the player tape /joueuralpha (/showthread.php?tid=607502)



register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

I want when the player tape /joueuralpha he can't do this a two times but only one times on his account

there is the code:

PHP Code:
COMMAND:joueuralpha(playeridparams[])
{
    
SendAdminText(playerid"/joueuralpha"params);
    if (
GetPVarInt(playerid"CMD_Used") == 1)
    return 
SendClientMessage(playerid, -1"Tu peux utiliser cette commandes qu'une seule fois.");
    if (
APlayerData[playerid][LoggedIn] == false) return 0;
    
SendClientMessage(playerid0xFFFFFFF,"Vous avez bien confirmez votre status de joueur alpha de truckingFR");
    
SendClientMessage(playerid0xFFFFFFF,"Vous aurez maintenant sur le forum le grade JoueurAlpha(en le disans cacaouet par pm а thomas_rp)");
    
SendClientMessage(playerid0xFFFFFFF,"Est vous recevez aussi 850 000$");
    new 
string[128], Name[129];
    
GetPlayerName(playeridNamesizeof(Name));
    
format(stringsizeof(string),"Le joueur %s а confirmer sont status de Joueur Alpha !"Name);
    
SendClientMessageToAll(-1string);
    
GivePlayerMoney(playerid850000);
    
SetPVarInt(playerid"CMD_Used"1);
    return 
1;

Thank for help !
+rep if you found the solution


Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

important please help


Re: register when the player tape /joueuralpha - luke49 - 20.05.2016

If you use MySQL/R33, then you can simply check if player is registered (when player types /joueuralpha):

after public OnGameModeInit():
PHP Code:
db mysql_connect(M_HostM_UserM_DataM_Pass); 
after CMD:joueuralpha(playerid, params[]):
PHP Code:
new query[128];
mysql_format(dbquerysizeof(query), "SELECT `Password` FROM `players` WHERE `Username` = BINARY('%s') LIMIT 1"GetpName(playerid)); //check if player exists
mysql_pquery(dbquery"registerAccount""d"playerid); 
somewhere at the bottom of your script:
PHP Code:
forward registerAccount(playerid);
public 
registerAccount(playerid)
{
    new 
rowsfields;
    
cache_get_data(rowsfieldsdb);
    if (
rows) {
        
//show that player is registered (is in database)
    
}
    else  {
        
//register player
    
}
    return 
1;




Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

I don't know how to use mysql

Errors everywhere :

Code:
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(56) : error 017: undefined symbol "cache_get_data"
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(55) : warning 203: symbol is never used: "fields"
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(18070) : error 017: undefined symbol "mysql_format"
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(18070) : warning 202: number of arguments does not match definition
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(18070) : warning 202: number of arguments does not match definition
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(18070) : error 017: undefined symbol "GetpName"
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(18071) : error 017: undefined symbol "mysql_pquery"
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(20406) : error 017: undefined symbol "db"
C:\Users\mickael\Desktop\Serveur SAMP\gamemodes\PPC.pwn(20406) : error 017: undefined symbol "mysql_connect"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Code :
line 52 to 64
PHP Code:
forward registerAccount(playerid);
public 
registerAccount(playerid)
{
    new 
rowsfields;
    
cache_get_data(rowsfieldsdb);
    if (
rows) {
        
//show that player is register
    
}
    else  {
        
//register player
    
}
    return 
1;

Line 18053 to 18072

PHP Code:
COMMAND:joueuralpha(playeridparams[])
{
    
SendAdminText(playerid"/joueuralpha"params);
    if (
GetPVarInt(playerid"CMD_Used") == 1)
    return 
SendClientMessage(playerid, -1"Tu peux utiliser cette commandes qu'une seule fois.");
    if (
APlayerData[playerid][LoggedIn] == false) return 0;
    
SendClientMessage(playerid0xFFFFFFF,"Vous avez bien confirmez votre status de joueur alpha de truckingFR");
    
SendClientMessage(playerid0xFFFFFFF,"Vous aurez maintenant sur le forum le grade JoueurAlpha(en le disans cacaouet par pm а thomas_rp)");
    
SendClientMessage(playerid0xFFFFFFF,"Est vous recevez aussi 850 000$");
    new 
string[128], Name[129];
    
GetPlayerName(playeridNamesizeof(Name));
    
format(stringsizeof(string),"Le joueur %s а confirmer sont status de Joueur Alpha !"Name);
    
SendClientMessageToAll(-1string);
    
GivePlayerMoney(playerid850000);
    
SetPVarInt(playerid"CMD_Used"1);
    new 
query[128];
    
mysql_format(dbquerysizeof(query), "SELECT `Password` FROM `players` WHERE `Username` = BINARY('%s') LIMIT 1"GetpName(playerid)); //check if player exists
    
mysql_pquery(dbquery"registerAccount""d"playerid);
    return 
1;




Re: register when the player tape /joueuralpha - luke49 - 20.05.2016

Oh, so if you do not use MySQL in your server, so my script will not help you. Do you use dini?


Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

No i don't use dini


Re: register when the player tape /joueuralpha - luke49 - 20.05.2016

Then try:

PHP Code:
COMMAND:joueuralpha(playeridparams[])
{
    
//SendAdminText(playerid, "/joueuralpha", params);
    
if (GetPVarInt(playerid"CMD_Used") == 1) {
        
SendClientMessage(playerid, -1"Tu peux utiliser cette commandes qu'une seule fois.");
    }
    else {
        if (
APlayerData[playerid][LoggedIn] == false) return 0;
        
SendClientMessage(playerid0xFFFFFFF,"Vous avez bien confirmez votre status de joueur alpha de truckingFR");
        
SendClientMessage(playerid0xFFFFFFF,"Vous aurez maintenant sur le forum le grade JoueurAlpha(en le disans cacaouet par pm а thomas_rp)");
        
SendClientMessage(playerid0xFFFFFFF,"Est vous recevez aussi 850 000$");
        new 
string[128], Name[129];
        
GetPlayerName(playeridNamesizeof(Name));
        
format(stringsizeof(string),"Le joueur %s а confirmer sont status de Joueur Alpha !"Name);
        
SendClientMessageToAll(-1string);
        
GivePlayerMoney(playerid850000);
        
SetPVarInt(playerid"CMD_Used"1);
    }
    return 
1;




Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

nop not working


Re: register when the player tape /joueuralpha - luke49 - 20.05.2016

What is not working? Player can type this command more than once?


Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

he can type it if he deconnect and reconnect


Re: register when the player tape /joueuralpha - luke49 - 20.05.2016

It means that CMD_Used does not save. Show me how you save it and load it.


Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

i don't know that's the problem


Re: register when the player tape /joueuralpha - luke49 - 20.05.2016

Then how do you save player's information, such as password, name, money, score and etc.? If you do not know, then try searching your script.


Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

With MySQL


Re: register when the player tape /joueuralpha - Eymeric69 - 20.05.2016

BUMP !


Re: register when the player tape /joueuralpha - luke49 - 20.05.2016

Some posts ago you said that you do not know how to use MySQL, now you say that you save player's information with MySQL, so where is the truth? I gave you an example some posts ago, you showed me some errors about mysql - it means that either you do not have any mysql information (plugin, .inc). or you do not have newest version of MySQL.

I can explain simpler: when player types /joueuralpha, check if account exists - if it exists show message that it exists, else register player with your desired way.