Need help with scripting something
#1

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?
Reply
#2

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.
Reply
#3

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
Reply
#4

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);
Reply
#5

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!)
Reply
#6

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!!!
Reply
#7

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")
Reply
#8

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);
       }
    }
Reply
#9

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
Reply
#10

Pl0x need help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)