SA-MP Forums Archive
Need help on Helpers - 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: Need help on Helpers (/showthread.php?tid=414065)



Need help on Helpers - DerickClark - 07.02.2013

Here my Code i Wanna to save the stat's on Helper's

Code:
COMMAND:sethelper(playerid, params[])
{
    new pID, str[128];
    if(!IsPlayerAdmin(playerid))
    return SendClientMessage(playerid, -1, "Only admins can use this command.");
    if(sscanf(params,"u", pID))
    return SendClientMessage(playerid,-1,"USAGE: /sethelper [PlayerID]");
    if(!IsPlayerConnected(pID))
    return SendClientMessage(playerid, -1, "ERROR: Selected player is not connected.");
    if(playerHelper[pID])
    return SendClientMessage(playerid, -1, "Selected player is a helper already.");
    new name[MAX_PLAYER_NAME+1], pName[MAX_PLAYER_NAME+1];
    GetPlayerName(pID, name, sizeof name);
    GetPlayerName(playerid, pName, sizeof pName);
    playerHelper[pID] = true;
    format(str, sizeof str, "Admin %s made you a helper.", pName);
    SendClientMessage(pID, -1, str);
    format(str, sizeof str, "You made %s a helper.", name);
    SendClientMessage(playerid, -1, str);
    // Let the server know that this was a valid command
    return 1;
}
Code:
// This function will save all player-data (used when the player disconnects from the server)
PlayerFile_Save(playerid)
{
        format(LineForFile, 100, "Helper %i\r\n", APlayerData[playerid][PlayerLevel]); // Construct the line: "Helper <playerlevel>"
	fwrite(PFile, LineForFile); // And save it to the file
	return 1;
}
Code:
  	        if (strcmp(ParameterName, "Helper", false) == 0) // If the parametername is correct ("Level")
                APlayerData[playerid][PlayerLevel] = strval(ParameterValue); // Store the playerlevel



Re: Need help on Helpers - zDevon - 07.02.2013

You store the player's helper level in playerHelper but you are saving APlayerData[playerid][PlayerLevel] (which I'm assuming is the player's score, since I see no where you set that equal to playerHelpler).


Re: Need help on Helpers - DerickClark - 07.02.2013

Can you give me the code? of the helper?