Y_Ini Save Bug?
#5

Quote:
Originally Posted by Meller
View Post
PHP Code:
#include <a_samp>
#include <command_proccessor> // zcmd for me
#include <sscanf2>
public OnPlayerConnect(playerid) {
    
    new 
path[64], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME);
    
format(path64"maplicenses/%s"name);
    if(
fexist(path))
        
SetPVarInt(playerid"mapping_license"1);
    else 
SetPVarInt(playerid"mapping_license"0);
    return 
1;
}
CMD:setmaplicense(playeridparams[]) {
    if(
IsPlayerAdmin(playerid)) {
        new 
targetidlicense;
        if(!
sscanf(params"ui"targetidlicense)) {
            
//always check for the first param first btw
            
if(IsPlayerConnected(targetid)) {
                if((
license == 1) || (license == 0)) {
                    if(
license != GetPVarInt(targetid"mapping_license")) {
                        new 
name[MAX_PLAYER_NAME], message[144], path[64];
                        
GetPlayerName(targetidnameMAX_PLAYER_NAME);
                        if(
license == 0) {
                            
GetPlayerName(playeridnameMAX_PLAYER_NAME);
                            
format(path64"maplicenses/%s"name);
                            if(
fexist(path))
                                
fremove(path);
                            
format(message144"[MAP] You have removed %s mapping license!"name);
                            
SendClientMessage(playerid0xFFFF00FFmessage);
                            if(
targetid != playerid) {
                                
GetPlayerName(playeridnameMAX_PLAYER_NAME);
                                
format(message144"[MAP] %s have removed your mapping license!"name);
                                
SendClientMessage(targetid0xFFFF00FFmessage);
                            }
                            
SetPVarInt(targetid"mapping_license"0);
                        }
                        else {
                            
GetPlayerName(playeridnameMAX_PLAYER_NAME);
                            
format(path64"maplicenses/%s"name);
                            if(!
fexist(path)) {
                                new 
File:file fopen(pathio_write);
                                
fclose(file);
                            }
                            
format(message144"[MAP] You have given %s a mapping license!"name);
                            
SendClientMessage(playerid0xFFFF00FFmessage);
                            if(
targetid != playerid) {
                                
GetPlayerName(playeridnameMAX_PLAYER_NAME);
                                
format(message144"[MAP] %s have given you a mapping license!"name);
                                
SendClientMessage(targetid0xFFFF00FFmessage);
                            }
                            
SetPVarInt(targetid"mapping_license"1);
                        }
                    }
                    else 
SendClientMessage(playerid0xFF0000FF"[Error:] That player already have their mapping license set at that!");
                }
                else 
SendClientMessage(playerid0xFF0000FF"[Error:] The valid number is only 0 and 1!");
            }
            else 
SendClientMessage(playerid0xFF0000FF"[Error:] That player is not connected!");
        }
        else 
SendClientMessage(playerid0xFF0000FF"[Error:] /givemaplicense <id> <0 - 1>");
    }
    else 
SendClientMessage(playerid0xFF0000FF"[Error:] You are not logged in to RCON!");
    return 
1;

There you go bud'.

To check if he's got a map license simply type:
PHP Code:
if(GetPVarInt(targetid"mapping_license") == 1) { } 
So, if I use your method will it fix my problem or you just showing me the simple way to do this?
Reply


Messages In This Thread
Y_Ini Save Bug? [SOLVED] - by AfiqIqbal - 17.06.2017, 12:58
Re: Y_Ini Save Bug? - by AfiqIqbal - 17.06.2017, 16:02
Re: Y_Ini Save Bug? - by Meller - 17.06.2017, 17:04
Re: Y_Ini Save Bug? - by Meller - 17.06.2017, 17:24
Re: Y_Ini Save Bug? - by AfiqIqbal - 17.06.2017, 17:56
Re: Y_Ini Save Bug? - by Meller - 17.06.2017, 18:56
Re: Y_Ini Save Bug? - by AfiqIqbal - 17.06.2017, 20:04
Re: Y_Ini Save Bug? - by AfiqIqbal - 18.06.2017, 04:03
Re: Y_Ini Save Bug? - by Sew_Sumi - 18.06.2017, 05:07
Re: Y_Ini Save Bug? - by AfiqIqbal - 18.06.2017, 05:11
Re: Y_Ini Save Bug? - by Kane_ - 18.06.2017, 05:44
Re: Y_Ini Save Bug? - by Sew_Sumi - 18.06.2017, 07:04
Re: Y_Ini Save Bug? - by AfiqIqbal - 18.06.2017, 13:17
Re: Y_Ini Save Bug? - by AfiqIqbal - 18.06.2017, 13:30
Re: Y_Ini Save Bug? - by Uberanwar - 18.06.2017, 13:36
Re: Y_Ini Save Bug? - by AfiqIqbal - 18.06.2017, 19:26

Forum Jump:


Users browsing this thread: 2 Guest(s)