register when the player tape /joueuralpha
#1

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
Reply
#2

important please help
Reply
#3

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;

Reply
#4

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;

Reply
#5

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

No i don't use dini
Reply
#7

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;

Reply
#8

nop not working
Reply
#9

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

he can type it if he deconnect and reconnect
Reply
#11

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

i don't know that's the problem
Reply
#13

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.
Reply
#14

With MySQL
Reply
#15

BUMP !
Reply
#16

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)