Need help with scripting something -
Songason - 19.07.2012
This is what I have no with my /repair cmd:
Код:
CMD:repair(playerid, params[])
{
RepairVehicle(GetPlayerVehicleID(playerid));
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You are not in a vehicle!");
SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle");
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_YELLOW, "The repair costed you 100 dollars");
PlayerPlaySound(playerid, 1133, 0, 0, 0);
return 1;
}
I want to add something special; that you can only do /repair in some red marker at that empty garage near Pershing Square (Some servers use it as VIP garage)
A red marker like that, but that's not the location. How to add it?
Re: Need help with scripting something -
[KHK]Khalid - 19.07.2012
You can use
SetPlayerCheckpoint to make that red marker ('Checkpoint'). I also suggest you to go to
that empty garage near Pershing Square and type /save then use the co-ordinates in
IsPlayerInRangeOfPoint instead of checkpoints.
Re: Need help with scripting something -
Songason - 19.07.2012
Quote:
Originally Posted by HellSphinX
You can use SetPlayerCheckpoint to make that red marker ('Checkpoint'). I also suggest you to go to that empty garage near Pershing Square and type /save then use the co-ordinates in IsPlayerInRangeOfPoint instead of checkpoints.
|
Thanks I'll try
Re: Need help with scripting something -
Songason - 19.07.2012
Quote:
Originally Posted by HellSphinX
You can use SetPlayerCheckpoint to make that red marker ('Checkpoint'). I also suggest you to go to that empty garage near Pershing Square and type /save then use the co-ordinates in IsPlayerInRangeOfPoint instead of checkpoints.
|
I can't , I've been trying. Can you do it for me so I can learn from the code?
Here are the cordinates for the red marker: AddPlayerClass(0,1520.9996,-1474.4762,9.5000,87.9920,0,0,0,0,0,0);
Re: Need help with scripting something -
newbienoob - 19.07.2012
Here
pawn Код:
new cp; //at the top of your script
cp = CreateDynamicCP(1520.9996,-1474.4762,9.5000,5,_,_,_,300); //under OnGameModeInit()
public OnPlayerEnterDynamicCP(playerid,checkpointid)//Create a new callback in your script.
{
if(checkpointid == cp)
{
RepairVehicle(GetPlayerVehicleID(playerid));
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You are not in a vehicle!");
SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle");
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_YELLOW, "The repair costed you 100 dollars");
PlayerPlaySound(playerid, 1133, 0, 0, 0);
}
return 1;
}
You need streamer plugin(****** it!)
Re: Need help with scripting something -
Songason - 19.07.2012
Quote:
Originally Posted by newbienoob
Here
pawn Код:
new cp; //at the top of your script cp = CreateDynamicCP(1520.9996,-1474.4762,9.5000,5,_,_,_,300); //under OnGameModeInit()
public OnPlayerEnterDynamicCP(playerid,checkpointid)//Create a new callback in your script. { if(checkpointid == cp) { RepairVehicle(GetPlayerVehicleID(playerid)); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You are not in a vehicle!"); SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle"); GivePlayerMoney(playerid, -100); SendClientMessage(playerid, COLOR_YELLOW, "The repair costed you 100 dollars"); PlayerPlaySound(playerid, 1133, 0, 0, 0); } return 1; }
You need streamer plugin(****** it!)
|
Thanks!!! I got streamer plugin, I will study this code so I learn from it and you'll get my +5 rep!!!
Re: Need help with scripting something -
Songason - 19.07.2012
Quote:
Originally Posted by newbienoob
Here
pawn Код:
new cp; //at the top of your script cp = CreateDynamicCP(1520.9996,-1474.4762,9.5000,5,_,_,_,300); //under OnGameModeInit()
public OnPlayerEnterDynamicCP(playerid,checkpointid)//Create a new callback in your script. { if(checkpointid == cp) { RepairVehicle(GetPlayerVehicleID(playerid)); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You are not in a vehicle!"); SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle"); GivePlayerMoney(playerid, -100); SendClientMessage(playerid, COLOR_YELLOW, "The repair costed you 100 dollars"); PlayerPlaySound(playerid, 1133, 0, 0, 0); } return 1; }
You need streamer plugin(****** it!)
|
I get the following errors
Код:
C:\Users\Sonny\Documents\SAMP server\gamemodes\Test.pwn(61) : error 017: undefined symbol "CreateDynamicCP"
C:\Users\Sonny\Documents\SAMP server\gamemodes\Test.pwn(385) : warning 235: public function lacks forward declaration (symbol "OnPlayerEnterDynamicCP")
Re: Need help with scripting something -
XStormiest - 19.07.2012
pawn Код:
//#define FILTERSCRIPT remove // if this is a fs
#include <a_samp>
#include <streamer>
forward OnPlayerEnterDynamicCP(playerid,checkpointid);
new cp; //at the top of your script
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
//filterscripts
public OnFilterScriptInit()
{
cp = CreateDynamicCP(1520.9996,-1474.4762,9.5000,5,_,_,_,300); //under OnGameModeInit()
}
public OnFilterScriptExit()
{
}
public OnPlayerEnterDynamicCP(playerid,checkpointid)//Create a new callback in your script.
{
if(checkpointid == cp)
{
RepairVehicle(GetPlayerVehicleID(playerid));
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You are not in a vehicle!");
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid,COLOR_GREEN,"You don't have enough money!!");
SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle");
if(!IsPlayerInRangeOfPoint(playerid,10, 1520.9996,-1474.4762,9.5000 ) return SendClientMessage(playerid,COLOR_GREEN,"You must be at garage to use this ( if don't know where a checkpoint had been setted on your map with red!");
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_YELLOW, "The repair costed you 100 dollars");
PlayerPlaySound(playerid, 1133, 0, 0, 0);
}
}
Re: Need help with scripting something -
Songason - 19.07.2012
Quote:
Originally Posted by newbienoob
Here
pawn Код:
new cp; //at the top of your script cp = CreateDynamicCP(1520.9996,-1474.4762,9.5000,5,_,_,_,300); //under OnGameModeInit()
public OnPlayerEnterDynamicCP(playerid,checkpointid)//Create a new callback in your script. { if(checkpointid == cp) { RepairVehicle(GetPlayerVehicleID(playerid)); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You are not in a vehicle!"); SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle"); GivePlayerMoney(playerid, -100); SendClientMessage(playerid, COLOR_YELLOW, "The repair costed you 100 dollars"); PlayerPlaySound(playerid, 1133, 0, 0, 0); } return 1; }
You need streamer plugin(****** it!)
|
I want it to be like when you do /repair, it will set the red marker and say that you can only use /repair there... Anyone please
Re: Need help with scripting something -
Songason - 19.07.2012
Pl0x need help