How to edit this
#1

Hello, i tried a lot of things but i dont know how to get this i want to edit that a player need to pay cash

see include:
http://pastebin.com/zX96D4dA


i did it like this:


Код:
/*----------------------------------------------------------------------------*\
					==============================
					 y_hooks - Hook any callback!
					==============================
Description:
	Automatically hooks any callbacks with a very simple syntax.
Legal:
	Version: MPL 1.1
	
	The contents of this file are subject to the Mozilla Public License Version 
	1.1 (the "License"); you may not use this file except in compliance with 
	the License. You may obtain a copy of the License at 
	http://www.mozilla.org/MPL/
	
	Software distributed under the License is distributed on an "AS IS" basis,
	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
	for the specific language governing rights and limitations under the
	License.
	
	The Original Code is the SA:MP callback hooks include.
	
	The Initial Developer of the Original Code is Alex "******" Cole.
	Portions created by the Initial Developer are Copyright © 2008
	the Initial Developer. All Rights Reserved.
	
	Contributors:
		ZeeX, koolk, JoeBullet/******63, g_aSlice/Slice
	
	Thanks:
		JoeBullet/******63 - Handy arbitrary ASM jump code using SCTRL.
		Peter, Cam - Support.
		ZeeX, g_aSlice/Slice, Popz, others - Very productive conversations.
		koolk - IsPlayerinAreaEx code.
		TheAlpha - Danish translation.
		breadfish - German translation.
		Fireburn - Dutch translation.
		yom - French translation.
		50p - Polish translation.
		Zamaroht - Spanish translation.
		Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
			for me to strive to better.
		Pixels^ - Running XScripters where the idea was born.
		Matite - Pestering me to release it and using it.
	
	Very special thanks to:
		Thiadmer - PAWN, whose limits continue to amaze me!
		Kye/Kalcor - SA:MP.
		SA:MP Team past, present and future - SA:MP.
	
Version:
	2.0
Changelog:
	25/02/12:
		Extracted most of the code to a separate file.
	17/03/11:
		Second complete re-write using another new technique.  Now VERY fast!
		Updated OnPlayerUpdate code using ******63's SCTRL jump code.
	06/08/10:
		First version
\*----------------------------------------------------------------------------*/

#if !defined _inc_y_hooks
	#error Did you do <YSI/y_hooks> instead of the required <YSI\y_hooks>?
#endif
#undef _inc_y_hooks

// Multiple includes!
#include <YSI\internal\y_unique>

#if defined _INC_y_hooks
	#endinput
#endif
// Everything except including "y_unique" is done once only.
#define _INC_y_hooks

#include <YSI\internal\y_dohooks>


enum pInfo
{
//	pCash
	
};
new PlayerInfo[MAX_PLAYERS][pInfo];


#define 		GetPlayerCash(%0) PlayerInfo[%0][pCash]
#define 		GivePlayerCash(%0,%1) PlayerInfo[%0][pCash] += (%1)
#define COLOR_LIGHTBLUE 0x33CCFFAA

#include <YSI\y_hooks>

Hook:paynspray_OnPlayerUpdate(playerid)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		new Float:vHealth;
		GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
		if(vHealth == 1000)
		{
			SetVehicleHealth(GetPlayerVehicleID(playerid), 999);
		}
		if(GetPlayerCash(playerid) >= 2500)
		{
			GivePlayerCash(playerid, -2500);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"   You have purchased an MP5!");
			return 1;
		}	
	        new const Float:paynspray[][] = {
	        {1025.05, -1024.23, 32.1}, // LS Temple
	        {487.68, -1740.87, 11.13}, // LS Santa Maria
			{-1420.73, 2583.37, 55.56}, // El Quebrados
			{-1904.39, 284.97, 40.75}, // Wang Cars
			{-2425.91, 1022.33, 50.10}, // Juniper Hill
			{1975.60, 2162.16, 10.77}, // LV Redsands
			{2065.38, -1831.51, 13.25}, // Idlewood
			{-99.55, 1118.36, 19.44}, // Fort Carson
			{721.07, -455.94, 16.04}, // Dillimore
			{2393.74, 1493.01, 10.52} // LV Unused (Pyramid)
	        };
	        for(new i=0; i<sizeof(paynspray); i++)
	        {
	            if(IsPlayerInRangeOfPoint(playerid, 10, paynspray[i][0], paynspray[i][1], paynspray[i][2]))
				{
					CallRemoteFunction("OnVehicleRespray", "iiii", playerid, GetPlayerVehicleID(playerid), -1, -1);
					return 1;
				}
			}
		}
	}
	return 1;
}

stock paynspray_CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay)
{
	new vid = CreateVehicle(vehicletype, x, y, z, rotation, color1, color2, respawn_delay);
	SetVehicleHealth(vid, 999);
	return vid;
}

#if defined _ALS_CreateVehicle
	#undef CreateVehicle
#else
	#define _ALS_CreateVehicle
#endif
#define CreateVehicle paynspray_CreateVehicle

stock paynspray_AddStaticVehicleEx(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay)
{
	new vid = AddStaticVehicleEx(vehicletype, x, y, z, rotation, color1, color2, respawn_delay);
	SetVehicleHealth(vid, 999);
	return vid;
}

#if defined _ALS_AddStaticVehicleEx
	#undef AddStaticVehicleEx
#else
	#define _ALS_AddStaticVehicleEx
#endif
#define AddStaticVehicleEx paynspray_AddStaticVehicleEx

stock paynspray_AddStaticVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2)
{
	new vid = AddStaticVehicle(vehicletype, x, y, z, rotation, color1, color2);
	SetVehicleHealth(vid, 999);
	return vid;
}

#if defined _ALS_AddStaticVehicle
	#undef AddStaticVehicle
#else
	#define _ALS_AddStaticVehicle
#endif
#define AddStaticVehicle paynspray_AddStaticVehicle
Reply
#2

Anyone ?
Reply
#3

Код:
Hook:paynspray_OnPlayerUpdate(playerid)
{
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
                new Float:vHealth;
                GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
                if(vHealth == 1000)
                {
                        SetVehicleHealth(GetPlayerVehicleID(playerid), 999);
                       
                new const Float:paynspray[][] = {
                {1025.05, -1024.23, 32.1}, // LS Temple
                {487.68, -1740.87, 11.13}, // LS Santa Maria
                        {-1420.73, 2583.37, 55.56}, // El Quebrados
                        {-1904.39, 284.97, 40.75}, // Wang Cars
                        {-2425.91, 1022.33, 50.10}, // Juniper Hill
                        {1975.60, 2162.16, 10.77}, // LV Redsands
                        {2065.38, -1831.51, 13.25}, // Idlewood
                        {-99.55, 1118.36, 19.44}, // Fort Carson
                        {721.07, -455.94, 16.04}, // Dillimore
                        {2393.74, 1493.01, 10.52} // LV Unused (Pyramid)
                };
                for(new i=0; i<sizeof(paynspray); i++)
                {
                    if(IsPlayerInRangeOfPoint(playerid, 10, paynspray[i][0], paynspray[i][1], paynspray[i][2]))
                                {
                                    if(GetPlayerCash(playerid) >= 2500)
                                    {
                                        CallRemoteFunction("OnVehicleRespray", "iiii", playerid, GetPlayerVehicleID(playerid), -1, -1);
                                        GivePlayerCash(playerid, -2500);
                                        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Thank you, the total today was 2,500.");   
                                    }
                                    else
                                    {
                                        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "You dont not have the money for this");
                                        return 1;
                                    }
                                }
                        }
                }
        }
        return 1;
}
Reply
#4

Anything?
Reply
#5

no not working
Still paying automaticly 100 $ and gets the money back
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)