PHP код:
CMD:addwater(playerid,params[])
{
if(PlayerInfo[playerid][pFaction] == 2) // faction id 2(LSFD)
{
new targetid,level,string[200];
if(sscanf(params, "ud", targetid, level)) return SendClientMessage(playerid,-1,"COMMAND: /addwater [Driver's ID] [Liter]"); // So, that means you need a "team" to full the water, but you can do it itself too.
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat"Driver is not online!");
if(level < 0 || level > 1) return SendClientMessage(playerid,-1,""chat" Choose EMPTY(0) or FULL(1)");
new Float:x, Float:y, Float:z;//these are the defines of your x,y and z position.
GetPlayerPos(playerid, x, y, z);//this will store your position to be used in the following codes.((this stores the your x,y, and z position in to the variables we created.))
if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))//this will check that if the player you want to add water is near you or not.
{
PlayerInfo[targetid][Water] = level;
format(string, sizeof(string), ""COL_RED"%s has set water %s in %s's firetruck.",PlayerName(playerid),level,PlayerName(targetid));
SendClientMessage(playerid,-1,string);
SendClientMessage(targetid,-1,string);
}
}
else {
SendClientMessage(playerid,-1,""COL_RED"You can't use this.");
}
return 1;
}
In this command you can add also the points of where you can add water.
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == 407)
{
if(PlayerInfo[playerid][Water] == 1)
PlayerInfo[playerid][Water] = 0; //we set this because we assume that player will use the water.
{
SendClientMessage(playerid, COLOR_COLOR,"Let's go!");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This vehicle doesn't have water, where are you going?");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Quote:
Originally Posted by Spawe
Could I have a function to guide me pls?
|