[HELP]Dcmd_Setscore
#1

Hey guys,
I made myself a /setscore command. When i type /setscore 999 it says i have set my score to 0. Can you also make this save so when i log in and log out it stays.

Код:
dcmd_setscore(playerid, params[])
{
	new givePlayer, pName[24], ReturnUserName[24], str[128], score;
	if(PlayerInfo[playerid][AdminLevel] < 4)
	{
		SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
		return 1;
	}
	if(sscanf(params, "u", givePlayer, score))
	{
		SendClientMessage(playerid, COLOR_GRAD1,"Usage: /setscore [playerid] [score]");
	}
	if(!IsPlayerConnected(givePlayer))
	{
		SendClientMessage(playerid, COLOR_RED, "Invalid playerid");
	}
	if(score <0 || score > 999999)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "The score cannot be lower than 0 and be higher than 999999");
	}
	GetPlayerName(playerid, pName, sizeof(pName));
	GetPlayerName(givePlayer, ReturnUserName, sizeof(ReturnUserName));

	SetPlayerScore(givePlayer, score);
	format(str, sizeof(str), "**(Admin)** %s (ID: %d) has set %s (ID: %d) score to %d.", pName, playerid, ReturnUserName, givePlayer, score);
	SendmAdminMsg(COLOR_LIGHTRED, str);
	return 1;
}
Thanks.
Reply
#2

Quote:

SetPlayerHealth(givePlayer, score);

lol

Try:
pawn Код:
SetPlayerScore(GetPlayerScore(givePlayer) + score);
switch with SetPlayerHealth, on my quote
Reply
#3

pawn Код:
dcmd_setscore(playerid, params[])
{
    new givePlayer, pName[24], ReturnUserName[24], str[128], score;
    if(PlayerInfo[playerid][AdminLevel] < 4)
    {
        SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
        return 1;
    }
    if(sscanf(params, "u", givePlayer, score))
    {
        SendClientMessage(playerid, COLOR_GRAD1,"Usage: /setscore [playerid] [score]");
    }
    if(!IsPlayerConnected(givePlayer))
    {
        SendClientMessage(playerid, COLOR_RED, "Invalid playerid");
    }
    if(score <0 || score > 999999)
    {
        SendClientMessage(playerid, COLOR_GRAD1, "The score cannot be lower than 0 and be higher than 999999");
    }
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(givePlayer, ReturnUserName, sizeof(ReturnUserName));

    SetPlayerScore(GetPlayerScore(givePlayer) + score);
    format(str, sizeof(str), "**(Admin)** %s (ID: %d) has set %s (ID: %d) score to %d.", pName, playerid, ReturnUserName, givePlayer, score);
    SendmAdminMsg(COLOR_LIGHTRED, str);
    return 1;
}
Reply
#4

Thanks I finally found that Now how would I make it save?
Reply
#5

pawn Код:
format(file,sizeof(file),"MyAdmin/Scores/%s.txt",n);
something like that

thats if ur making a admin system

PHP код:
If not check the scripting tutorials for how to make something save :) 
Reply
#6

Quote:
Originally Posted by Kidemo
Посмотреть сообщение
pawn Код:
format(file,sizeof(file),"MyAdmin/Scores/%s.txt",n);
something like that

thats if ur making a admin system

PHP код:
If not check the scripting tutorials for how to make something save :) 
I mean to add in the player file
E.G:
Код:
enum pInfo
{
AdminLevel,
}
Код:
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][AdminLevel] = dini_Int(pFile, "AdminLevel");
Like that but linked with the command. Once the command is type it will save the score into the pInfo file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)