GiveplayerMoney to GiveplayerCash
#1

I really need to change this too GivePlayerCash.

But when i doo i get a warning..

I also tried to #define GivePlayercash but then i get this warning:

warning 215: expression has no effect

If this can be fixed that would mayorly help me.

Thx in Advance

PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
new PizzaJob[256];
public 
OnFilterScriptInit()
{
    
AddStaticVehicle(448,2122.1677,-1784.2250,12.9837,180.4585,0,0); // Pizza 1
    
AddStaticVehicle(448,2121.9895,-1784.7623,12.9867,181.5936,0,0); // Pizza 1
    
AddStaticVehicle(448,2118.8469,-1784.5692,12.9880,181.5090,0,0); // Pizza 2
    
AddStaticVehicle(448,2115.7837,-1784.6464,12.9860,181.6605,0,0); // Pizza 3
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/pizza"cmdtexttrue10) == 0)
    {
        if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
        {
            
PizzaJob[playerid] = 1;
            new 
name[MAX_PLAYER_NAME], string[48];
            
GetPlayerName(playeridnamesizeof(name));
            
format(stringsizeof(string), "* %s is now a Pizzaboy."name );
            
SendClientMessageToAll(COLOR_YELLOWstring);
            
SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
            
SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
            return 
1;
        }
        
SendClientMessage(playeridCOLOR_RED,"You have to be on a pizza bike to start the job!");
    }
    return 
0;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
     if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
     {
         
SendClientMessage(playeridCOLOR_RED"* You can start the pizza courier by using /pizza");
     }
     return 
0;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
     if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
     {
        if(
PizzaJob[playerid] == 1){
            
PizzaJob[playerid] = 2;
            
SetPlayerCheckpoint(playerid,2012.4771,-1640.1229,13.1431,10);
            
SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            return 
1;
         }
        if(
PizzaJob[playerid] == 2){
            
PizzaJob[playerid] = 3;
            
SetPlayerCheckpoint(playerid,2387.0063,-1667.1498,13.1249,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 3){
            
PizzaJob[playerid] = 4;
            
SetPlayerCheckpoint(playerid,2414.9255,-1649.6678,13.1305,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 4){
            
PizzaJob[playerid] = 5;
            
SetPlayerCheckpoint(playerid,2517.6394,-1678.3141,13.9862,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 5){
            
PizzaJob[playerid] = 6;
            
SetPlayerCheckpoint(playerid,2441.1526,-2017.4093,13.1231,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 6){
            
PizzaJob[playerid] = 7;
            
SetPlayerCheckpoint(playerid,2486.2058,-2017.6384,13.1309,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 7){
            
PizzaJob[playerid] = 8;
            
SetPlayerCheckpoint(playerid,2520.9238,-2016.4714,13.1395,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 8){
            
PizzaJob[playerid] = 9;
            
SetPlayerCheckpoint(playerid,2464.7258,-2000.3944,13.1430,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 9){
            
PizzaJob[playerid] = 10;
            
SetPlayerCheckpoint(playerid,2240.8374,-1886.9504,13.1486,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 10){
            
PizzaJob[playerid] = 11;
            
SetPlayerCheckpoint(playerid,2095.5488,-1815.7517,12.9792,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 11){
            
PizzaJob[playerid] = 0;
            
DisablePlayerCheckpoint(playerid);
            
SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $5000 for delivering the pizzas.");
            
GivePlayerMoney(playerid,5000);
         }
     }
     return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    if(
PizzaJob[playerid] > 0)
    {
        
PizzaJob[playerid] = 0;
        
SendClientMessage(playeridCOLOR_RED"* You have left your job, you won't be payed.");
        
DisablePlayerCheckpoint(playerid);
    }

Reply
#2

pawn Код:
#Define GivePlayerMoney GivePlayerCash
this?
Reply
#3

That's because there's no such thing as GivePlayerCash till you declare it.

That's not done through #define by the way...

I'm assuming this is part of an anticheat?
Reply
#4

pawn Код:
stock GivePlayerCash(playerid, money)
{
    PlayerInfo[playerid][pCash] += money;
    ResetMoneyBar(playerid);
    UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
    return PlayerInfo[playerid][pCash];
}
Tho I advise reading

https://sampforum.blast.hk/showthread.php?tid=71136
Reply
#5

Yeah its from anticheat..

But i want to use it in the FS. Cause GivePlayerMoney doesnt work thx to the anticheat.

Its already worked out in the GM.

Where do i place that
PHP код:
stock GivePlayerCash(playeridmoney)
{
    
PlayerInfo[playerid][pCash] += money;
    
ResetMoneyBar(playerid);
    
UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
    return 
PlayerInfo[playerid][pCash];

Reply
#6

I have the same problem.
Reply
#7

Ohh... Your gonna have problems with that :/
Unless you intend to save the money from the FS to a textfile or something and load it into your script that way, it's really impractical to try and give server-sided money to a FS variable. Why? Because the FS itself I'm pretty sure can't actually access GM variables and vice-versa.

If i'm right, it means that there is no benefit to having GivePlayerCash @ all in a FS.
Your better off to include that scripting into your GM, and wherever you use GivePlayerMoney, change it so that you actually just add the amount to PlayerInfo[playerid][pCash]
Reply
#8

Quote:
Originally Posted by remyguys
Посмотреть сообщение
Yeah its from anticheat..

But i want to use it in the FS. Cause GivePlayerMoney doesnt work thx to the anticheat.

Its already worked out in the GM.

Where do i place that
PHP код:
stock GivePlayerCash(playeridmoney)
{
    
PlayerInfo[playerid][pCash] += money;
    
ResetMoneyBar(playerid);
    
UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
    return 
PlayerInfo[playerid][pCash];

Well under nothing to say the truth, on the end of the script? I do a small //============[Stock]========== for example and put all stocks in there
Reply
#9

Then i get errors...

error 017: undefined symbol "PlayerInfo"
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
error 017: undefined symbol "PlayerInfo"

All on this line : PlayerInfo[playerid][pCash] += money;

PHP код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA


new PizzaJob[256];


public 
OnFilterScriptInit()
{

    
AddStaticVehicle(448,2122.1677,-1784.2250,12.9837,180.4585,0,0); // Pizza 1
    
AddStaticVehicle(448,2121.9895,-1784.7623,12.9867,181.5936,0,0); // Pizza 1
    
AddStaticVehicle(448,2118.8469,-1784.5692,12.9880,181.5090,0,0); // Pizza 2
    
AddStaticVehicle(448,2115.7837,-1784.6464,12.9860,181.6605,0,0); // Pizza 3

}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/pizza"cmdtexttrue10) == 0)
    {
        if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
        {
            
PizzaJob[playerid] = 1;
            new 
name[MAX_PLAYER_NAME], string[48];
            
GetPlayerName(playeridnamesizeof(name));
            
format(stringsizeof(string), "* %s is now a Pizzaboy."name );
            
SendClientMessageToAll(COLOR_YELLOWstring);
            
SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
            
SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
            return 
1;
        }
        
SendClientMessage(playeridCOLOR_RED,"You have to be on a pizza bike to start the job!");
    }
    return 
0;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
     if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
     {
         
SendClientMessage(playeridCOLOR_RED"* You can start the pizza courier by using /pizza");
     }
     return 
0;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
     if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
     {
        if(
PizzaJob[playerid] == 1){
            
PizzaJob[playerid] = 2;
            
SetPlayerCheckpoint(playerid,2012.4771,-1640.1229,13.1431,10);
            
SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            return 
1;
         }
        if(
PizzaJob[playerid] == 2){
            
PizzaJob[playerid] = 3;
            
SetPlayerCheckpoint(playerid,2387.0063,-1667.1498,13.1249,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 3){
            
PizzaJob[playerid] = 4;
            
SetPlayerCheckpoint(playerid,2414.9255,-1649.6678,13.1305,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 4){
            
PizzaJob[playerid] = 5;
            
SetPlayerCheckpoint(playerid,2517.6394,-1678.3141,13.9862,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 5){
            
PizzaJob[playerid] = 6;
            
SetPlayerCheckpoint(playerid,2441.1526,-2017.4093,13.1231,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 6){
            
PizzaJob[playerid] = 7;
            
SetPlayerCheckpoint(playerid,2486.2058,-2017.6384,13.1309,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 7){
            
PizzaJob[playerid] = 8;
            
SetPlayerCheckpoint(playerid,2520.9238,-2016.4714,13.1395,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 8){
            
PizzaJob[playerid] = 9;
            
SetPlayerCheckpoint(playerid,2464.7258,-2000.3944,13.1430,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 9){
            
PizzaJob[playerid] = 10;
            
SetPlayerCheckpoint(playerid,2240.8374,-1886.9504,13.1486,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 10){
            
PizzaJob[playerid] = 11;
            
SetPlayerCheckpoint(playerid,2095.5488,-1815.7517,12.9792,10);
            return 
1;
         }
        if(
PizzaJob[playerid] == 11){
            
PizzaJob[playerid] = 0;
            
DisablePlayerCheckpoint(playerid);
            
SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $5000 for delivering the pizzas.");
            
GivePlayerCash(playerid5000);
         }
     }
     return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    if(
PizzaJob[playerid] > 0)
    {
        
PizzaJob[playerid] = 0;
        
SendClientMessage(playeridCOLOR_RED"* You have left your job, you won't be payed.");
        
DisablePlayerCheckpoint(playerid);
    }
}
//============[Stock]==========
stock GivePlayerCash(playeridmoney)
{
    
PlayerInfo[playerid][pCash] += money;
    
ResetMoneyBar(playerid);
    
UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
    return 
PlayerInfo[playerid][pCash];

Reply
#10

i Changed the whole GM to GivePlayerMoney etc.

Change all words cash to Money. Now it works. :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)