SA-MP Forums Archive
Helmet problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Helmet problem (/showthread.php?tid=469238)



Helmet problem - vn007322815 - 12.10.2013

i want to write /helmet to put helmet on if i type again helmet then the helmet goes off pleasee help

Код:
#include <a_samp>
#define HELM_DIALOG 123456
//define the dialog ID here so it won't inflict with other dialogs on your gamemode.


public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/helm", true == 0) { //Using strcmp because i don't know your command processor, should be avoided anyway.
       if(IsPlayerAttachedObjectSlotUsed(playerid, 3))
          RemovePlayerAttachedObject(playerid, 3);
       else
          SetPlayerAttachedObject(playerid, 3, 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
       return 1;
}
i have got 2 Errors.

Код:
C:\Users\ta\Desktop\NVCNR\filterscripts\helmets.pwn(8) : warning 213: tag mismatch
C:\Users\ta\Desktop\NVCNR\filterscripts\helmets.pwn(8) : error 001: expected token: ")", but found "{"
C:\Users\ta\Desktop\NVCNR\filterscripts\helmets.pwn(15) : error 030: compound statement not closed at the end of file (started at line 8)



Re: Helmet problem - DanishHaq - 12.10.2013

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/helm", true == 0)) { //Using strcmp because i don't know your command processor, should be avoided anyway.
       if(IsPlayerAttachedObjectSlotUsed(playerid, 3))
          RemovePlayerAttachedObject(playerid, 3);
       else
          SetPlayerAttachedObject(playerid, 3, 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
       return 1;
    }
}



Re: Helmet problem - vn007322815 - 12.10.2013

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/helm", true == 0)) { //Using strcmp because i don't know your command processor, should be avoided anyway.
       if(IsPlayerAttachedObjectSlotUsed(playerid, 3))
          RemovePlayerAttachedObject(playerid, 3);
       else
          SetPlayerAttachedObject(playerid, 3, 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
       return 1;
    }
}
i have got 2 warning

Код:
C:\Users\ta\Desktop\NVCNR\filterscripts\helmets.pwn(8) : warning 213: tag mismatch
C:\Users\ta\Desktop\NVCNR\filterscripts\helmets.pwn(15) : warning 209: function "OnPlayerCommandText" should return a value



Re: Helmet problem - vn007322815 - 12.10.2013

pls help


Re: Helmet problem - DanishHaq - 12.10.2013

pawn Код:
#include <a_samp>
#define HELM_DIALOG 123456

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/helm"))
    {
        if(IsPlayerAttachedObjectSlotUsed(playerid, 3))
        {
            RemovePlayerAttachedObject(playerid, 3);
        }
        else
        {
            SetPlayerAttachedObject(playerid, 3, 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
        }
    }
    return 1;
}



Re: Helmet problem - vn007322815 - 12.10.2013

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
pawn Код:
#include <a_samp>
#define HELM_DIALOG 123456

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/helm"))
    {
        if(IsPlayerAttachedObjectSlotUsed(playerid, 3))
        {
            RemovePlayerAttachedObject(playerid, 3);
        }
        else
        {
            SetPlayerAttachedObject(playerid, 3, 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
        }
    }
    return 1;
}
oh my god is working perfect thank u very very much