SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/05/2016, 06:22 AM   #1
UnholyBeast
Big Clucker
 
Join Date: Oct 2015
Location: Alberta, Canada
Posts: 50
Reputation: 8
Question How would I add parameters to this?

PHP Code:
public OnPlayerText(playeridtext[])
{
    new 
healcmd[] = "#heal"targetidhealthvalue;
    if(!
strcmp(texthealcmdtargetidhealthvalue))
    {
        if(!
IsPlayerAdmin(playerid)) return NormalPlayerChat(playeridtext);
        if(
IsPlayerAdmin(playerid))
        {
            new 
rcon_msg[144], healed_self[144];
            if(
sscanf(params"ud"targetidhealthvalue)) return SendClientMessage(playerid0x32CD32CD"USAGE: !heal <targetid> <amount of health>");
            if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid0x32CD32CD"That ID is not connected to a player.");
            if(
targetid == playerid)
            {
                
SetPlayerHealth(playeridhealthvalue);
                
format(healed_selfsizeof(healed_self), "You have set your own health to: %d"healthvalue);
                
SendClientMessage(playerid0x32CD32CDhealed_self);
            }
            
format(rcon_msgsizeof(rcon_msg), "You have set \"%s(%d)'s\" health to: %d"PlayerName(playerid), playeridhealthvalue);
            
SetPlayerHealth(targetidhealthvalue);
            
SendClientMessage(playerid, -1rcon_msg);
        }
        return 
0;
    }
    
NormalPlayerChat(playeridtext);
    return 
0;

UnholyBeast is offline   Reply With Quote
Old 25/05/2016, 07:55 AM   #2
Naruto_Emilio
Banned
 
Join Date: Apr 2011
Location: North Africa
Posts: 1,297
Reputation: 365
Default Re: How would I add parameters to this?

strcmp if string compare, you cant use it like that, I suggest you to start using zcmd & sscanf instead its much easier and easier to read & write aswell
Naruto_Emilio 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
3 Parameters. kubeba59 Scripting Help 0 31/01/2014 11:14 AM
Different parameters in one command Sasoft Scripting Help 8 20/06/2013 02:12 PM
parameters Fernado Samuel Scripting Help 3 03/03/2013 12:27 AM
Parameters for a DM? Kevin_Joshen Help Archive 8 05/08/2010 07:27 AM
Please Help: Parameters and such. Kevin_Joshen Help Archive 6 27/07/2010 01:00 AM


All times are GMT. The time now is 12:18 PM.


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