GetPlayerMoney Commands..
#1

Hey,
i Have a commands like /N, /Rainbowcar, But, i want if the player will have 10,000$
So its will give him it,
and if no, its will say that he cant, look my commands.

PHP код:
if (strcmp("/rainbowcar"cmdtexttrue14) == 0)
{
if(
IsPlayerInAnyVehicle(playerid))
{
if(
GetPlayerMoney(playerid) >= 10000)
{
SendClientMessage(playeridCOLOR_RED"You Spend Now 10,000$ On Rainbowcar, Enjoy.w ")
KillTimer(CTimer2);
KillTimer(CTimer3);
KillTimer(CTimer4);
KillTimer(CTimer5);
KillTimer(CTimer6);
KillTimer(CTimer7);
KillTimer(CTimer8);
KillTimer(CTimer9);
KillTimer(CTimer10);
KillTimer(CTimer11);
CTimer1 SetTimerEx("Color1"5000"d" ,playerid);
GivePlayerMoney(playeridGetPlayerMoney(playerid) - 10000);
}
if(
GetPlayerMoney(playerid) < 10000)
{
SendClientMessage(playerid, -1"You dont have enough money");
}
}
        else
        {
            
SendClientMessage(playeridCOLOR_RED"You are not in a vehicle.");
        }
    } 
PHP код:
if(!strcmp(cmdtext,"/nos",true))
{
if(
NosOnByAdmin == 0)
{
SendClientMessage(playerid0xFF0000FF"האדמין לא הפעיל את אפשרות הנייטרוס, מצטערים.");
}
if(
NosOnByAdmin == 1)
{
if(
GetPlayerMoney(playerid) > 10000)
{
GivePlayerMoney(playeridGetPlayerMoney(playerid) -10000);
{
if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You are not in a vehicle! - אתה לא בתוף רכב!"); // If the player is not in vehicle...
if(GetVehicleComponentInSlot(GetPlayerVehicleID(playerid),GetVehicleComponentType(1010)) != 1010// Check if the vehicle has no nitro
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1010); // Adding nitro
PlayerPlaySound(playerid,1133,0.0,0.0,0.0); // Sound of vehicle improving
SendClientMessage(playerid0xFF0000FF"You add nitro to your car ! - הוספת נייטרוס לרכבך בהצלחה !");
}
if(
GetPlayerMoney(playerid) < 10000)
{
SendClientMessage(playerid, -1"You dont have enough money");
}
}
}
}
return 
1;

Something..? Some 1 helP?
Reply
#2

pawn Код:
if (strcmp("/rainbowcar", cmdtext, true, 14) == 0)
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle.");
    if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, -1, "You dont have enough money");  
    SendClientMessage(playerid, COLOR_RED, "You Spend Now 10,000$ On Rainbowcar, Enjoy.w ")
    KillTimer(CTimer2);
    KillTimer(CTimer3);
    KillTimer(CTimer4);
    KillTimer(CTimer5);
    KillTimer(CTimer6);
    KillTimer(CTimer7);
    KillTimer(CTimer8);
    KillTimer(CTimer9);
    KillTimer(CTimer10);
    KillTimer(CTimer11);
    CTimer1 = SetTimerEx("Color1", 500, 0, "d" ,playerid);
    GivePlayerMoney(playerid,- 10000);
    return 1;
}
pawn Код:
if(!strcmp(cmdtext,"/nos",true))
{
    if(NosOnByAdmin == 0) return SendClientMessage(playerid, 0xFF0000FF, "האדמין לא הפעיל את אפשרות הנייטרוס, מצטערים.");
    if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, -1, "You dont have enough money");      
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You are not in a vehicle! - אתה לא בתוף רכב!"); //    If the player is not in vehicle...
    if(GetVehicleComponentInSlot(GetPlayerVehicleID(playerid),GetVehicleComponentType(1010)) != 1010) // Check if the vehicle has no    nitro
    {
        GivePlayerMoney(playerid, -10000);
        AddVehicleComponent(GetPlayerVehicleID(playerid),1010); // Adding nitro
        PlayerPlaySound(playerid,1133,0.0,0.0,0.0); // Sound of vehicle improving
        SendClientMessage(playerid, 0xFF0000FF, "You add nitro to your car ! - הוספת נייטרוס לרכבך בהצלחה !");
    }
    return 1;
}
Try this
Reply
#3

A note for you, you don't need to use 12 timers for a rainbowcar, it's hilarious. Just use one timer and change the vehicle color every x milliseconds. And you can use random function.
pawn Код:
new
    color1 = random( 256 ),
    color2 = random( 256 )
;
ChangeVehicleColor( GetPlayerVehicleID( playerid ), color1, color2 );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)