SA-MP Forums Archive
Need Help From Scripters - 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: Need Help From Scripters (/showthread.php?tid=289011)



Need Help From Scripters - DaRkAnGeL[NBK] - 09.10.2011

Hey i am building my own filterscript which shall include a save system, login dialogs and VIP system but im stuck -.- i dont understand how i would create a setvip command, could someone give me a hand please?

-thanks


Re: Need Help From Scripters - GrimR - 09.10.2011

Do you know how to make commands (using zcmd etc), just need to check the person using the commands has the right priviliges (is an administrator etc) and change the users vip variable (which should be apart of their main variables like position, money, cars etc) to true or 1 meaning they are VIP, then in other parts check the users VIP variable is 1 to do anything VIP specific.


Re: Need Help From Scripters - DaRkAnGeL[NBK] - 09.10.2011

um could you link me to a tut for zcmd? please


Re: Need Help From Scripters - GrimR - 09.10.2011

If you have the library/include in the right place, you need to #include <zcmd>.

Then write each command like this:

pawn Код:
CMD:setvip(playerid, params[])
{
  // Put all command code here.
  return 1;
}
playerid refers to id of player that the command and params[] stores any information/parameters entered after the initial /command, using sscanf2 is quite easy for extracting param data once you get used to it.


Re: Need Help From Scripters - DaRkAnGeL[NBK] - 09.10.2011

thanks for the reply but im very new to scripting so know nothing about that kind of thing as i can make gangmodes to a degree but cant do multiple command strings including more then 1 playerid so could you help me at all ? it would be most appreciated thanks


Re: Need Help From Scripters - GrimR - 09.10.2011

It's kind of hard at the moment as i'm at work and doing it from my iPhone lol.

You need to find the main zcmd and sscanf2 (not sscanf) topics in the filterscript and include or plugin sections and follow their directions for downloading and putting the files in the correct places, plus the #includes for both.

Once you have that all good, I can write a couple things for you to test out and see how it all works, plus the main threads for zcmd amd sscanf2 give you an idea of how to use it also.


Re: Need Help From Scripters - DaRkAnGeL[NBK] - 09.10.2011

i tryed i did:
pawn Код:
#include <zcmd>
#include <sscanf2>
and then the command:

pawn Код:
CMD:pm(playerid, params[])
{
    new id, message;
    if(sscanf(params,"us[128]", id, Message))
    {
        new string[128];
        format(string, sizeof(string),"PM From %s[ID: %d]: %s", GetName(id), id, Message);
        SendClientMessage(playerid, -1, string);

        format(string, sizeof(string),"PM To %s[ID: %d]: %s", GetName(playerid), id, Message);
        SendClientMessage(id, -1, string);
    }
    else SendClientMessage(playerid, -1,"Usage: /pm [id][message]");
    return 1;
}
i get this error for some reason tho :

pawn Код:
C:\Users\Unlimited DMers\Desktop\Fas FreeRoam\gamemodes\saving2.pwn(196) : error 029: invalid expression, assumed zero
C:\Users\Unlimited DMers\Desktop\Fas FreeRoam\gamemodes\saving2.pwn(196) : error 017: undefined symbol "cmd_pm"
C:\Users\Unlimited DMers\Desktop\Fas FreeRoam\gamemodes\saving2.pwn(196) : error 029: invalid expression, assumed zero
C:\Users\Unlimited DMers\Desktop\Fas FreeRoam\gamemodes\saving2.pwn(196) : fatal error 107: too many error messages on one line

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


4 Errors.



Re: Need Help From Scripters - GrimR - 09.10.2011

In your sscanf you have Message with a capital M instead of small m.

Also not that using if sscanf actually fires off if there is a problem not if it's successful.

I know it's weird but a lot of people write them that way for some strange reason. So send your error message if sscanf and otherwise do your thing.


Re: Need Help From Scripters - $India$ - 10.10.2011

pawn Код:
CMD:setvip(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >= 1 || IsPlayerAdmin(playerid) == 1)
    {
        new id, level;
        if(sscanf(params,"ui", id, level) return SendClientMessage(playerid, -1,"SYNTAX: /setvip [id] [leve]");
        {
            PlayerInfo[id][pVip] = level;
        }
    }
    else SendClientMessage(playerid, -1,"You are not an Admin!");
    return 1;
}
This is Basic and change the Variables to your FS Variables...
And Ahamm.. Rep+


Re: Need Help From Scripters - GrimR - 10.10.2011

Yeah on a side note, wouldn't IsPlayerAdmin be sufficient in whatevet command sets admin priviliges, as from then on you only need to check one thing everywhere else rather than 2 things?