Need Help
#1

Who can help me with this

PHP код:
CMD:pay(playeridparams[])
{
  new 
otheridcash;
  if (
sscanf(params"dd"otheridcash)) SendClientMessage(playerid0xFF0000AA"Usage: /pay [ID] [Cash]");
  else
  {
    if(
GetPlayerMoney(playerid) > cashSendClientMessage(playeridCOLOR_RED"You don't have that much!");
    else if(!
IsPlayerConnected(otherid)) SendClientMessage(playeridCOLOR_RED"That PlayerID is not connected!");
    else if(
otherid == playeridSendClientMessage(playeridCOLOR_RED"It is pointless to pay yourself..");
    else
    {
      
GivePlayerMoney(playerid, -cash);
      
GivePlayerMoney(otheridcash);
    }
  }
  return 
1;

help with this command to can work in Range 5 metre's
need for RP
Reply
#2

this is works in game but u want it in range of 5 meter ?
Reply
#3

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
this is works in game but u want it in range of 5 meter ?
yes i need in range of 5 meters
Reply
#4

use
Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(otherid,x,y,z);
if(IsPlayerInRangeOf(playerid, 5.0, x,y,z) != 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not close enought to that player!");
Edit it as yourself wants to
Hope i helped
Reply
#5

Quote:
Originally Posted by Ranama
Посмотреть сообщение
use
Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(otherid,x,y,z);
if(IsPlayerInRangeOf(playerid, 5.0, x,y,z) != 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not close enought to that player!");
Edit it as yourself wants to
Hope i helped
man please give me cmd + this :d
Reply
#6

pawn Код:
CMD:pay(playerid, params[])
{
    new otherid, cash;
    if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]");
    else
    {
        if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!");
        if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!");
        if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself..");
        else
        {
             new Float:X, Float:Y, Float:Z;
             GetPlayerPos(otherid, X, Y, Z);
             if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z);
             {
                 GivePlayerMoney(playerid, -cash);
                 GivePlayerMoney(otherid, cash);
             }
             else return SendClientMessage(playerid, -1, "You are not close enough to the specified player!");
          }
    }
    return 1;
}
Try this
Reply
#7

Quote:
Originally Posted by rscaerzx
Посмотреть сообщение
pawn Код:
CMD:pay(playerid, params[])
{
    new otherid, cash;
    if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]");
    else
    {
        if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!");
        if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!");
        if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself..");
        else
        {
             new Float:X, Float:Y, Float:Z;
             GetPlayerPos(otherid, X, Y, Z);
             if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z);
             {
                 GivePlayerMoney(playerid, -cash);
                 GivePlayerMoney(otherid, cash);
             }
             else return SendClientMessage(playerid, -1, "You are not close enough to the specified player!");
          }
    }
    return 1;
}
Try this
D:\BG-RP\samp03e_svr_win32\gamemodes\register.pwn(2792) : error 001: expected token: ")", but found ";"
D:\BG-RP\samp03e_svr_win32\gamemodes\register.pwn(2792) : error 036: empty statement
D:\BG-RP\samp03e_svr_win32\gamemodes\register.pwn(2797) : error 029: invalid expression, assumed zero
D:\BG-RP\samp03e_svr_win32\gamemodes\register.pwn(2797) : warning 215: expression has no effect
D:\BG-RP\samp03e_svr_win32\gamemodes\register.pwn(2797) : error 001: expected token: ";", but found "return"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

try this

Код:
CMD:pay(playerid, params[]) 
{ 
    new otherid, cash; 
    if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]"); 
    else 
    { 
        if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!"); 
        if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!"); 
        if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself.."); 
        else 
        {
             new Float:X, Float:Y, Float:Z;
             GetPlayerPos(otherid, X, Y, Z);
             if(!IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z)) return SendClientMessage(playerid, -1, "You are not close enough to the specified player!"); 
             GivePlayerMoney(playerid, -cash); 
             GivePlayerMoney(otherid, cash);
         }
    } 
    return 1; 
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)