can someone tell me if i did this right. ive never done YCMD before but yeah lol.
pawn Код:
#include <a_samp>
#include <sscanf2>
#include <YSI/y_ini>
#include <YSI\y_commands>
#include <streamer>
#define FILTERSCRIPT
#define COLOR_RED 0xFF0000AA
#define COLOR_WHITE 0xFFFFFFAA
YCMD:healplayer(playerid,params[],help)
{
#pragma unused help
if(P_Data[playerid][pJob] != 2) return SCM(playerid,COLOR_RED,"ERROR:"COL_WHITE"You are not ");
new pplayerid,price,Float:Position[3];
if(sscanf(params,"ui",pplayerid,price)) return SCM(playerid,COLOR_RED,""COL_WHITE"Usage: /healplayer [Player ID/Part OfName] [Price]");
if(!PlayerWork[playerid]) return SCM(playerid,COLOR_RED,"ERROR: "COL_WHITE"Type /startjob");
if(PlayerVeh[playerid] != GetPlayerVehicleID(playerid)) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not in your vehicle");
if(pplayerid == INVALID_PLAYER_ID) return SCM(playerid,COLOR_RED,"ERROR:"COL_WHITE"Invalid ID");
GetPlayerPos(pplayerid,Position[0],Position[1],Position[2]);
if(!IsPlayerInRangeOfPoint(playerid,5.0,Position[0],Position[1],Position[2])) return SCM(playerid,COLOR_RED,"ERROR:"COL_WHITE"You are not near to that player");
Seller[pplayerid] = playerid;
Price[pplayerid] = price;
SendFormatMSG(pplayerid,-1,"Player with job Los Santos EMS has you offered to heal you for price: %d type /accept",price);
SCM(playerid,-1,"Wait for player answer");
return 1;
}
==============In command /accept
if(strcmp(text,"healplayer",false) == 0)
{
if(Seller[playerid] == 999) return SCM(playerid,COLOR_RED,"No body hasn't gave you an offer");
if(Price[playerid] > GetPlayerMoney(playerid)) return SCM(playerid,COLOR_RED,"You don't have that much money"),Seller[playerid] = 999;
SCM(Seller[playerid],-1,"Player has accepted the offer");
SCM(playerid,-1,"You have accepted the offer");
GivePlayerMoney(Seller[playerid],Price[playerid]);
GivePlayerMoney(playerid,-Price[playerid]);
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+100);
}