SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/05/2014, 10:00 PM   #1
DarkLored
High-roller
 
DarkLored's Avatar
 
Join Date: Oct 2013
Location: U.S. New York
Posts: 1,045
Reputation: 61
Default Command problem

Hello guys so when a player registers his Inv1 == IDCard but when i do /i use 1 it eats a sandwich and shows the IDCard

i don't know why this is happening but here is the code i use correctly for it

pawn Code:
CMD:i(playerid,params[])
{
    new option[4], itemslot, string[128];
    if (sscanf(params, "s[4]i", option, itemslot)) return SendClientMessage(playerid, -1, "USAGE: /i use (itemslot).");
    if (!strcmp(option, "use", true))
    {
        if (itemslot == 1)
        {
            new firetext[20], drivetext[20];
            if(pInfo[playerid][pFireArms] == 0)
            {
                firetext = "None";
            }
            if(pInfo[playerid][pFireArms] == 1)
            {
               firetext = "Yes";
            }
            if(pInfo[playerid][pDrive] == 0)
            {
               drivetext = "None";
            }
            if(pInfo[playerid][pDrive] == 1)
            {
               drivetext = "Yes";
            }
            itemslot = pInfo[playerid][pInv1];
            if(pInfo[playerid][pInv1] == IDCard[playerid] && IDCard[playerid] == 1)//ID Card
            {
               format(string,sizeof(string),"Name: %s\nDriving License: %s\nFirearms License: %s",GetName(playerid),drivetext,firetext);
               ShowPlayerDialog(playerid,IDCARD,DIALOG_STYLE_MSGBOX,"ID CARD",string,"Ok","");
            }
            if(pInfo[playerid][pInv1] == BusTicket[playerid] && BusTicket[playerid] == 1)//Bus Ticket
            {

            }
            if(pInfo[playerid][pInv1] == Sandwich[playerid] && Sandwich[playerid] >= 1)//Sandwich
            {
               Sandwich[playerid] -= 1;
               RestoreHealth[playerid] = 10;
               ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1, 1, 1, 1, 0, 5000, 1);
               for(new i = 0; i < MAX_PLAYERS; i++){
               if(PlayerToPlayer(playerid,i,13)){
               format(string,sizeof(string),"{F700FF}*%s starts eating a sandwich.",GetName(playerid));
               SendClientMessage(i,-1,string);}}
            }
        }
    }
    else SendClientMessage(playerid, -1, "Available options: use");
    return 1;
}

Saving system
pawn Code:
INI_WriteInt(file,"Inventory_Slot_1", IDCard[playerid] = 1);//ID Card
            INI_WriteInt(file,"Inventory_Slot_2", BusTicket[playerid] = 1);//Bus Ticket
            INI_WriteInt(file,"Inventory_Slot_3", 0);
            INI_WriteInt(file,"Inventory_Slot_4", Sandwich[playerid] = 1);//Sandwich
            INI_WriteInt(file,"Inventory_Slot_5", Water[playerid] = 1);//Water
            INI_WriteInt(file,"Inventory_Slot_6", 0);
            INI_WriteInt(file,"Inventory_Slot_7", Sprunk[playerid] = 1);//Sprunk
__________________
deviantArt

Taking my time on focusing on Education and learning how to draw.

Quote:
Originally Posted by KevinExec View Post
I don't know shit, you're an expert, telling me what to do and how noobish I am, do you think I get you?

P.S.: I offer .ini scripting services.

- Quoted by not other than KevinExec, the "master" of PAWN language
Quote:
Originally Posted by iMTube™ View Post
don't act OP coz u will never be Op
Rest in Pieces iMTube™, you won't be missed coz you are Op
DarkLored is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Problem... server returns only "unknown command" Anak Scripting Help 4 19/12/2013 06:06 AM
Problem with command. Only returns Server: Unknown Command Knappen Scripting Help 9 18/12/2013 06:09 PM
Problem with command , UNKNOWN COMMAND Jony_Cruze Server Support 4 05/01/2013 06:04 AM
Problem with command , UNKNOWN COMMAND Jony_Cruze Scripting Help 29 20/12/2012 03:17 PM
Command problem(gate command) pliptm Help Archive 0 01/06/2011 05:35 PM


All times are GMT. The time now is 10:11 AM.


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