SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/05/2014, 05:02 AM   #1
Trynda
Banned
 
Join Date: Apr 2014
Posts: 172
Reputation: 0
Default Giveplayerid

Hello, im really confused with this

I want the /givetoken

and it will increase the token value of player depends on token value i type

pawn Code:
CMD:givetoken(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] == 6)
    {
        new giveplayerid;
        new string[128];
        if(sscanf(params, "ud", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givetoken [playerid/partofname] [token value]");

        format
    }
}
Trynda is offline   Reply With Quote
Old 09/05/2014, 05:10 AM   #2
mrtms
Big Clucker
 
Join Date: Jul 2012
Location: WA
Posts: 97
Reputation: 9
Default Re: Giveplayerid

PHP Code:
CMD:givetoken(playeridparams[])
{
    new 
giveplayeridtokenstring[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"ud"giveplayeridtoken)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /givetoken [player] [amount]");
    
    
//This really depends on the variable you use to store the tokens
    
PlayerInfo[giveplayerid][pTokens] += token;
    
    
format(stringsizeof(string), "%s has given you %d token(s)!"GetPlayerName(playerid), token);
    
SendClientMessage(giveplayeridCOLOR_WHITEstring);
    return 
1;

I'm not to sure what you use to store the value of the token to the player, so I made up some random variable under the enum of PlayerInfo. Just replace the PlayerInfo[giveplayerid][pTokens], with the correct variable you use to store the amount of tokens a player has.
mrtms is offline   Reply With Quote
Old 09/05/2014, 05:17 AM   #3
Trynda
Banned
 
Join Date: Apr 2014
Posts: 172
Reputation: 0
Default Re: Giveplayerid

Quote:
Originally Posted by mrtms View Post
PHP Code:
CMD:givetoken(playeridparams[])
{
    new 
giveplayeridtokenstring[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"ud"giveplayeridtoken)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /givetoken [player] [amount]");
    
    
//This really depends on the variable you use to store the tokens
    
PlayerInfo[giveplayerid][pTokens] += token;
    
    
format(stringsizeof(string), "%s has given you %d token(s)!"GetPlayerName(playerid), token);
    
SendClientMessage(giveplayeridCOLOR_WHITEstring);
    return 
1;

I'm not to sure what you use to store the value of the token to the player, so I made up some random variable under the enum of PlayerInfo. Just replace the PlayerInfo[giveplayerid][pTokens], with the correct variable you use to store the amount of tokens a player has.
Thanks bro (+rep) But how about the /checktoken?
Trynda is offline   Reply With Quote
Old 09/05/2014, 05:22 AM   #4
mrtms
Big Clucker
 
Join Date: Jul 2012
Location: WA
Posts: 97
Reputation: 9
Default Re: Giveplayerid

PHP Code:
CMD:checktoken(playeridparams[])
{
    new 
giveplayeridstring[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /checktoken [player]");
    
    
format(stringsizeof(string), "%s Tokens: %d"GetPlayerName(giveplayerid). PlayerInfo[giveplayerid][pToken]);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    return 
1;

mrtms is offline   Reply With Quote
Old 09/05/2014, 05:23 AM   #5
[..MonTaNa..]
Huge Clucker
 
[..MonTaNa..]'s Avatar
 
Join Date: Feb 2013
Location: Sweden
Posts: 411
Reputation: 7
Default Re: Giveplayerid

EDIT: too late
__________________
FiRAT =)
[..MonTaNa..] is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
giveplayerid help [HELP ME] ChristianIvann09 Scripting Help 1 31/03/2014 10:47 AM
giveplayerid error Don_Cage Scripting Help 18 08/09/2013 03:10 PM
GivePlayerID Dixon_Smith Scripting Help 15 17/09/2012 06:41 AM
error in giveplayerid! Selluliitti_mies Help Archive 2 01/03/2009 10:03 PM


All times are GMT. The time now is 08:05 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.