cmd help
#1

hello guys, I have this cmd:
Код:
CMD:makemegod(playerid, params[]){
if(IsPlayerAdmin(playerid))
{
	PlayerInfo[playerid][Admin] += 999999;
	PlayerInfo[playerid][Score] += 999999;
	SetPlayerScore(playerid, 999999);
}
else SendClientMessage(playerid, COLOR_SYS, "** You are not authorized to use this command. **");
return 1;
}
it compiles fine, but it doesn't save the values on the ini file, how do i have to save it?
Reply
#2

PHP код:
CMD:makemegod(playeridparams[]){
if(
IsPlayerAdmin(playerid))
{
    
PlayerInfo[playerid][Admin] += 999999;
    
PlayerInfo[playerid][Score] += 999999;
    
SetPlayerScore(playerid999999);
        new 
INI:File INI_Open(UserPath(playerid));
        
INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
        
INI_Close(File);
}
else 
SendClientMessage(playeridCOLOR_SYS"** You are not authorized to use this command. **");
return 
1;

done!
Reply
#3

Quote:
Originally Posted by Gotham
Посмотреть сообщение
PHP код:
CMD:makemegod(playeridparams[]){
if(
IsPlayerAdmin(playerid))
{
    
PlayerInfo[playerid][Admin] += 999999;
    
PlayerInfo[playerid][Score] += 999999;
    
SetPlayerScore(playerid999999);
        new 
INI:File INI_Open(UserPath(playerid));
        
INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
        
INI_Close(File);
}
else 
SendClientMessage(playeridCOLOR_SYS"** You are not authorized to use this command. **");
return 
1;

done!
thanks! but when are the times i have to use this?
Код:
new INI:File = INI_Open(UserPath(playerid));
        INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
        INI_Close(File);
And why is it used for the score only and not for setting admin level?

p.s. how can i create a money cmd like that? to save the value?

thanks alot!
Reply
#4

Код:
CMD:givemoney(playerid, params[])
{
   new string[128];
     if(!IsPlayerAdmin) return SendClientMessage(playerid, -1, "Not Logged Rcon Admin!");
     if(sscanf(params, "ud", params[0], params[1] )) return SendClientMessage(playerid, -1, "Use: /Givemoney [ID] [Money]");
    format(string, sizeof(string), "You have gived %d Money" , params[1]);
    SendClientMessage(playerid, -1, string);
    GivePlayerMoney(playerid, params[1]);
    return 1;
}
Reply
#5

You use INI_Open whenever you want the server to open the text file.

INI_Write to write into the file, quite self explanatory. This can only be done after you have opened the file.

INI_Close to release the file from the server. Should be done after you finish emitting data into the file.

Quote:
Originally Posted by Eloy
Посмотреть сообщение
CMD:givemoney(playerid, params[])
{

}
What a useless post. You're the reason I wish negative reputation still existed.
Reply
#6

Sorry, Sended message pressed Bar space in my keyboard
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)