SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   Problem with /repair and /accept repair (https://forum.sa-mp.com/showthread.php?t=635431)

tekass 06/06/2017 11:32 PM

I need help for /repair and /acceptrepair please
 
Hi all i would need help for a commands with job mechanic.
Here's how I started (you'll notice I'm new to the script):

Code:

//===============================Reparer======================================//
dcmd_reparer(playerid, params[])
{
        if(PlayerInfo[playerid][pJob] == 1)
        {
        new string[128];
        new montant = GivePlayerMoney(playerid, montant);
        new playerid2 = GetPlayerVehicleID(playerid);
        if(sscanf(params, "ud", playerid2, montant)) return SendClientMessage(playerid, -1, "USAGE: /reparer [ID] [montant]");
        {
        if(IsPlayerInAnyVehicle(playerid2))
                {
                  GetPlayerName(playerid, string,sizeof(montant));
                  format(string, sizeof(string), "Vous avez réparé le véhicule de %s pour $%d.", GetPlayerVehicleID(playerid2), GivePlayerMoney(playerid, montant++));
                  SendClientMessage(playerid, COLOR_ORANGE, string);
                GetPlayerName(playerid2, string, sizeof(montant));
                  format(string, sizeof(string), "Le mécanicien a réparé votre véhicule pour $%d.", GivePlayerMoney(playerid2, montant--));
                  SendClientMessage(playerid2, COLOR_ORANGE, string);
                  RepairVehicle(GetPlayerVehicleID(playerid2));
                }
        else return SendClientMessage(playerid, COLOR_RED,"ERREUR: Le client n'est pas dans son véhicule ou vous n'êtes pas mécanicien!");
        }
        if(GetPlayerMoney(playerid2) < montant)
                {
                return SendClientMessage(playerid, COLOR_RED,"ERREUR: Vous n'avez pas asser d'argent sur vous!");
                }
        }
        return 1;
}


Kane 06/06/2017 11:34 PM

Re: Problem with /repair and /accept repair
 
Change the "z" in if(sscanf(params, "uz", playerid2, montant)) to a d.

https://image.prntscr.com/image/c6ba...b3e149d749.png

tekass 07/06/2017 12:11 AM

Re: Problem with /repair and /accept repair
 
Ha yes thanks fot this info :D

+1 rep for you :)

tekass 07/06/2017 12:15 AM

Re: Problem with /repair and /accept repair
 
i need again help for for call "money" whitout the defined with GetPlayerMoney(playerid,money) please.

tekass 07/06/2017 02:34 PM

Re: Problem with /repair and /accept repair
 
new problem...

Code:

C:\Users\KEVIN\Desktop\New_RP_Life\pawno\include\YSI\..\YSI_Storage\..\YSI_Internal\amx_assembly.inc(38) : fatal error 111: user error: Please update "https://github.com/Zeex/amx_assembly" to get "deref()"


Compilation aborted.Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

i have download y_assembly.inc at https://github.com/Zeex/amx_assembly but it's always the same...

You have idea? :/

MrFantasy 07/06/2017 02:39 PM

Re: Problem with /repair and /accept repair
 
Search http://forum.sa-mp.com/showthread.php?p=3730318

tekass 07/06/2017 10:03 PM

Re: Problem with /repair and /accept repair
 
i have extracted the amx_assembly folder in YSI/amx and nothing same with YSI_Internal or Ysi_Storage

i don't know what to do... :/

tekass 07/06/2017 10:56 PM

Re: Problem with /repair and /accept repair
 
Ha is good it's my command /accepterep but i don't know the relationship with YSI...
The suject is return at the normaly

tekass 20/06/2017 02:15 PM

Re: Problem with /repair and /accept repair
 
I thinks i need to remake all the command with another method...You have an idea please?

tekass 20/06/2017 03:21 PM

Re: Problem with /repair and /accept repair
 
I tried with this new method:

Code:

dcmd_reparer(playerid, params[])
{
        if(PlayerInfo[playerid][pJob] == 1)
        {
        new string[128];
        new montant = strval(params);
        new playerid2 = GetPlayerVehicleID(playerid);
        if(sscanf(params, "ud", playerid2, montant)) return SendClientMessage(playerid, -1, "USAGE: /reparer [ID] [montant]");
        {
        if(IsPlayerInAnyVehicle(playerid2))
                {
                  GetPlayerName(playerid, string,sizeof(montant));
                  format(string, sizeof(string), "%s à réparé le véhicule du client pour $%d.",playerid, GivePlayerMoney(playerid, montant));
                  SendClientMessage(playerid, COLOR_ORANGE, string);
                GetPlayerName(playerid2, string, sizeof(montant));
                  format(string, sizeof(string), "Le mécanicien a réparé votre véhicule pour -$%d.", GivePlayerMoney(playerid2, -montant));
                  SendClientMessage(playerid2, COLOR_ORANGE, string);
                  RepairVehicle(GetPlayerVehicleID(playerid2));
                }
        else return SendClientMessage(playerid, COLOR_RED,"ERREUR: Le client n'est pas dans son véhicule ou vous n'êtes pas mécanicien!");
        }
        if(GetPlayerMoney(playerid2) < montant)
                {
                return SendClientMessage(playerid, COLOR_RED,"ERREUR: Vous n'avez pas asser d'argent sur vous!");
                }
        }
        return 1;
}



All times are GMT. The time now is 03:07 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.