How do you can only once use that command ?
#1

How can I do on command player can do that once ? I mean in command : /getcarrefund , To make player can do that once and not anymore , Choose his color for car ETC , And to make he cant get restricted car , 490[FBI Rancher] ETC... Heres the command :

Код:
CMD:getcarrefund(playerid, params[])
{
    new string[128], playerid, modelid, color1, color2;
    if(sscanf(params, "uddd", modelid, color1, color2)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /getcarrefund [modelid] [color 1] [color 2]");

    if(color1 < 0 || color1 > 126) { SendClientMessageEx(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
    if(color2 < 0 || color2 > 126) { SendClientMessageEx(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
    if(modelid < 400 || modelid > 611) { SendClientMessageEx(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 or above 611 !"); return 1; }
    new playervehicleid = GetPlayerFreeVehicleId(playerid); new carsamount = GetPlayerVehicleCount(playerid);
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    new Float:Angle;
    GetPlayerFacingAngle(playerid,Angle);
    new car = CreatePlayerVehicle(playerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0);
    if(car == INVALID_PLAYER_VEHICLE_ID)
	{
        SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
    }
    else
	{
        format(string, sizeof(string), " Vehicle successfully created with ID %d.", car);
        SendClientMessageEx(playerid, COLOR_GRAD1, string);
    }

    format(string, sizeof(string), "%s has refund one car for himself a %s (Color 1: %d | Color 2: %d).", GetPlayerNameEx(playerid), GetVehicleName(car), color1, color2);
    Log("logs/playervehicle.log", string);
    return 1;
}

}
Reply
#2

pawn Код:
enum Done
{
   Yes
}
new answer[MAX_PLAYERS][Done];

forward answer_load(playerid, name[], value[]);
public answer_load(playerid, name[], value[])
{
 INI_Int("Yes", answer[playerid][Yes]);
 return 1;
}

CMD:getcarrefund(playerid, params[])
{
   if(answer[playerid][Yes] < 1)
   {
    new string[128], playerid, modelid, color1, color2;
    if(sscanf(params, "uddd", modelid, color1, color2)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /getcarrefund [modelid] [color 1] [color 2]");

    if(color1 < 0 || color1 > 126) { SendClientMessageEx(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
    if(color2 < 0 || color2 > 126) { SendClientMessageEx(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
    if(modelid < 400 || modelid > 611) { SendClientMessageEx(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 or above 611 !"); return 1; }
    new playervehicleid = GetPlayerFreeVehicleId(playerid); new carsamount = GetPlayerVehicleCount(playerid);
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    new Float:Angle;
    GetPlayerFacingAngle(playerid,Angle);
    new car = CreatePlayerVehicle(playerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0);
    if(car == INVALID_PLAYER_VEHICLE_ID)
    {
        SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
    }
    else
    {
        format(string, sizeof(string), " Vehicle successfully created with ID %d.", car);
        SendClientMessageEx(playerid, COLOR_GRAD1, string);
    }

    format(string, sizeof(string), "%s has refund one car for himself a %s (Color 1: %d | Color 2: %d).", GetPlayerNameEx(playerid), GetVehicleName(car), color1, color2);
    Log("logs/playervehicle.log", string);
    answer[playerid][Yes] =1;
   }
   if(answer[playerid][Yes] == 1)
   {
     SendClientMessage(playerid, -1,"You Had Already used this command');
   }
   return 1;
}
Reply
#3

Код:
 d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP2Reported.pwn(5909) : error 017: undefined symbol "INI_Int"
What to do ?
Reply
#4

pawn Код:
#include <YSI/y_ini>
Reply
#5

pawn Код:
#include <YSI\y_ini>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)