SA-MP Forums Archive
Little help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little help (/showthread.php?tid=230955)



Little help - Anzhelov - 24.02.2011

I would like to make /pay command for RP server using ProxDetector, can you help me
Format + Prox Detector
Код:
ProxDetector(40.0, playerid, str, COLOR_ACTION,COLOR_ACTION,COLOR_ACTION,COLOR_ACTION,COLOR_ACTION);
It must send message to all players (40 meters near), * [Name_Lastname] takes out some money and gave it to [Name_Lastname] *
and to the SendClientMessage to the guy who get the money
You received [amout of money] from [Name Lastname].
Thanks.


Re: Little help - Mean - 24.02.2011

Use IsPlayerInRangeOfPoint. https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: Little help - Anzhelov - 24.02.2011

What is wrong with that command
Код:
if(!strcmp(cmdtext, "/enter", true))
    {
    if(IsPlayerInRangeOfPoint(playerid, 2.0, -1390.1477,2638.7412,55.9844))
	{
    SetPlayerPos(playerid, 246.7830,63.9027,1003.6406);
    SetPlayerFacingAngle(playerid, 0.0000);
    SetPlayerInterior(playerid, 10);
    return 1;
    }



Re: Little help - Ash. - 24.02.2011

It should be;
pawn Код:
if(!strcmp(cmdtext, "/enter", true))
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, -1390.1477,2638.7412,55.9844))
    {
        SetPlayerPos(playerid, 246.7830,63.9027,1003.6406);
        SetPlayerFacingAngle(playerid, 0.0000);
        SetPlayerInterior(playerid, 10);
        return 1;
    }
}



Re: Little help - Anzhelov - 24.02.2011

Quote:
Originally Posted by Anzhelov
Посмотреть сообщение
I would like to make /pay command for RP server using ProxDetector, can you help me
Format + Prox Detector
Код:
ProxDetector(40.0, playerid, str, COLOR_ACTION,COLOR_ACTION,COLOR_ACTION,COLOR_ACTION,COLOR_ACTION);
It must send message to all players (40 meters near), * [Name_Lastname] takes out some money and gave it to [Name_Lastname] *
and to the SendClientMessage to the guy who get the money
You received [amout of money] from [Name Lastname].
Thanks.
So with the /pay command, can someone help me ?


Re: Little help - maramizo - 24.02.2011

@OP I'm doing it.


Re: Little help - maramizo - 24.02.2011

pawn Код:
CMD:pay(playerid, params[])
{
    new giveplayerid, gamount, name1, name2, Float:X,Float:Y,Float:Z;
    if(sscanf,"ui",giveplayerid, gamount) return SendClientMessage(playerid, 0xFF0000, "USAGE: /pay [PlayerID/PartofName] [Amount]");
    if(GetPlayerMoney(playerid) < gamount) return SendClientMessage(playerid,0xFF0000, "You do not have that amount of money.");
    if(giveplayerid = INVALID_PLAYER_ID) return SendClientMessage(playerid,0xFF0000, "The player ID/Name entered is INVALID.");
    GetPlayerName(playerid, name1, sizeof(name1));
    GetPlayerName(giveplayerid, name2, sizeof(name2));
    GetPlayerPos(playerid,X,Y,Z);
    foreach(Player, i)
    {
        If(IsPlayerInRangeOfPoint(i,40.0,X,Y,Z)
        {
            new msg[128];
            format(msg,sizeof(msg),"%s takes out some money and gives it to %s", name1, name2);
            SendClientMessage(i,0xD900FF,msg);
            new msg2[100];
            format(msg2,sizeof(msg2),"You have recieved $%i from %s", gamount, name1);
            SendClientMessage(giveplayerid, 0xFFFFFF, msg2);
            return 1;
        }
    }
    return 1;
}
Make sure you include foreach, zcmd and sscanf2.


Re: Little help - maramizo - 24.02.2011

Notice that I did not use ProxDetector, I myself never liked it, It may be shorter but it confuses me, I'd rather use IsPlayerInRangeOfPoint.


Re: Little help - Mean - 24.02.2011

Quote:
Originally Posted by funky1234
Посмотреть сообщение
It should be;
pawn Код:
if(!strcmp(cmdtext, "/enter", true))
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, -1390.1477,2638.7412,55.9844))
    {
        SetPlayerPos(playerid, 246.7830,63.9027,1003.6406);
        SetPlayerFacingAngle(playerid, 0.0000);
        SetPlayerInterior(playerid, 10);
        return 1;
    }
}
No, it should be:
pawn Код:
if(!strcmp(cmdtext, "/enter", true))
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, -1390.1477,2638.7412,55.9844))
    {
        SetPlayerPos(playerid, 246.7830,63.9027,1003.6406);
        SetPlayerFacingAngle(playerid, 0.0000);
        SetPlayerInterior(playerid, 10);
    }
    return 1;
}



Re: Little help - Anzhelov - 24.02.2011

Код:
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\ROLE FUCKING PLAY\gamemodes\VRP.pwn(5) : fatal error 100: cannot read from file: "foreach"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.