how to make command to use one time
#1

now i need make command use one time like fix command
pawn Код:
if(strcmp(cmdtext, "/fix", true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if(IsPlayerInArea(playerid, 1153.0000, 1307.5000, -2107.5000, -2003.5000) == 1)
            {
                SendClientMessage(playerid,COLOR_RED,"You are not allowed to repair your vehicle in /BloodringArena.");
            }
            else
            {
                SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
                SendClientMessage(playerid,COLOR_BASIC,"Your vehicle has been fixed.");
                SendClientMessage(playerid,COLOR_GREY,"Info: press the -Submission key- to repair your vehicle.");
                SendClientMessage(playerid,COLOR_GREY,"        ( = key to activate smoke on a stuntplane).");
                PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "(You must be inside a vehicle to use this command).");
        }
        return 1;
    }
oh and how to make flip command to use one time too
[url=https://sampforum.blast.hk/showthread.php?pid=755007#pid755007&posted=1#post755007]join this topic to help me for thing[/url
Reply
#2

pawn Код:
SetPVarInt(playerid, "FixUsed", 1);

if(GetPVarInt(playerid, "FixUsed") == 1) { // you have already used fix! }
Reply
#3

pawn Код:
if(strcmp(cmdtext, "/fix", true) == 0)
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "(You must be inside a vehicle to use this command).");
    if(IsPlayerInArea(playerid, 1153.0000, 1307.5000, -2107.5000, -2003.5000) == 1) return SendClientMessage(playerid,COLOR_RED,"You are not allowed to repair your vehicle in /BloodringArena.");
    if(GetPVarInt(playerid, "FixUsed") == 1) return SendClientMessage(playerid,COLOR_RED,"You have already used fix!");
    SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
    SendClientMessage(playerid,COLOR_BASIC,"Your vehicle has been fixed.");
    SendClientMessage(playerid,COLOR_GREY,"Info: press the -Submission key- to repair your vehicle.");
    SendClientMessage(playerid,COLOR_GREY,"        ( = key to activate smoke on a stuntplane).");
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
    SetPVarInt(playerid, "FixUsed", 1);
    return 1;
}
Reply
#4

Код:
E:\МнггжП~1\GAMEMO~1\sumo.pwn(255) : error 017: undefined symbol "GetPVarInt"
E:\МнггжП~1\GAMEMO~1\sumo.pwn(260) : error 017: undefined symbol "SetPVarInt"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#5

Use
pawn Код:
SetPVarInt(playerid, "FixUsed") == 1)
instead, worked for my script.
Not sure tough, but give it a try
Reply
#6

not work
Reply
#7

Download the 0.3a scripting package.
Reply
#8

look i have errors
pawn Код:
if(!strcmp(cmdtext, "/repair") || !strcmp(cmdtext, "/r") || !strcmp(cmdtext, "/fix"))
    {
        SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
        SendClientMessage(playerid,0xF5260FFF,"You Repair Your Vehicle");
        SendClientMessage(playerid,0xF5260FFF,"%s Repair his vehicle (/repair)",PlayerName);
        SendClientMessage(playerid,0xF5260FFF,"You Repair Your Vehicle");
SetPVarInt(playerid, "FixUsed", 1);
 if(GetPVarInt(playerid, "FixUsed") == 1) return SendClientMessage(playerid,COLOR_RED,"You have already used fix!");
        return 1;
}
               
if(!strcmp(cmdtext, "/flip") || !strcmp(cmdtext, "/f"))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new Float:PX, Float:PY, Float:PZ, Float:PA;
            GetPlayerPos(playerid, PX, PY, PZ);
            GetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
            SetVehiclePos(GetPlayerVehicleID(playerid), PX, PY, PZ+1);
            SetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
            SendClientMessage(playerid,0xF5260FFF,"You flip Your Vehicle");
            SendClientMessage(playerid,0xF5260FFF,"%s flip his vehicle (/flip)",PlayerName);
            SendClientMessage(playerid,0xF5260FFF,"You flip Your Vehicle");
    SetPVarInt(playerid, "FixUsed", 1);
 if(GetPVarInt(playerid, "FixUsed") == 1) return SendClientMessage(playerid,COLOR_RED,"You have already used fix!");
        }
        return 1;
Код:
(255) : error 017: undefined symbol "GetPVarInt"
(260) : error 017: undefined symbol "SetPVarInt"
how i repair this errors
Reply
#9

Wow...
Read some guides...
You really missed up the code.
Reply
#10

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Download the 0.3a scripting package.
Read above.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)