02.05.2010, 23:35
Hey, is it possible to call functions in gamemode/filterscripts from a npc mode?
Thanks
Thanks
#define RECORDING "LicenseA" #define RECORDING_TYPE 1 #include <a_npc> new CyclesMin=20; new CyclesMax=40; new CyclesATM=35; new gTimerLicense; public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING); #if RECORDING_TYPE == 1 public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING); public OnNPCExitVehicle() StopRecordingPlayback(); #else public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING); #endif main() { printf("License"); } public OnNPCModeInit() { gTimerLicense=SetTimer("TimerLicense",2000,1); } public OnNPCModeExit() { KillTimer(gTimerLicense); } forward TimerLicense(); public TimerLicense() { CyclesATM++; if(CyclesATM>CyclesMin) { if(CyclesATM>CyclesMax || random(10)<2) { new Amount=10000;//need to calculate a random amount, so the money wont stack up new NPCcmd[32]; format(NPCcmd,sizeof(NPCcmd),"/dt %d",Amount); // thats the "drop treasure" command, it will create a simple money pickup... SendCommand(NPCcmd); new msg[128]; format(msg,128,"/Aq make your license! get less wanted levels for stealing a vehicle!",Amount); SendCommand(msg); format(msg,128,"i got $#mon here, i will drop some!",Amount); //#mon is a quickstring, it will insert your actual money, its processed in the GM... SendChat(msg); CyclesATM=0; } } }
dcmd_Aq(playerid,params[]) { new Text[128]; if (sscanf(params,"s",Text)) { SendClientMessage(playerid,MSGCOMM_COLOR, "Usage: \"/Aq <Text>\""); return 1; } AddNews(playerid,Text); return 1; } forward AddNews(playerid,Text[]); public AddNews(playerid,Text[]) { // SendClientMessage(playerid,0xffffffff,Text); format(TDTSMessageText,sizeof(TDTSMessageText),"%s%s_",TDTSMessageText,Text); //looks weird, i know :) ShowTDTS(); return 1; }
. regards ..: babul