PDA

View Full Version : Need Help From Scripters


DaRkAnGeL[NBK]
09/10/2011, 08:28 PM
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

GrimR
09/10/2011, 08:37 PM
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.

DaRkAnGeL[NBK]
09/10/2011, 08:58 PM
um could you link me to a tut for zcmd? please

GrimR
09/10/2011, 09:08 PM
If you have the library/include in the right place, you need to #include <zcmd>.

Then write each command like this:


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.

DaRkAnGeL[NBK]
09/10/2011, 09:11 PM
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

GrimR
09/10/2011, 09:25 PM
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.

DaRkAnGeL[NBK]
09/10/2011, 09:34 PM
i tryed i did:

#include <zcmd>
#include <sscanf2>


and then the command:


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 :

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.

GrimR
09/10/2011, 09:56 PM
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.

$India$
10/10/2011, 04:10 AM
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+

GrimR
10/10/2011, 04:24 AM
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?

$India$
10/10/2011, 04:32 AM
????...

TheLazySloth
10/10/2011, 04:34 AM
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?

Agreed.

????...

He means that only the /makeadmin command should be an rcon set command and the rest will be sided by the scripter set PlayerInfo[playerid][pAdminLevel] variable that way instead of if(IsPlayerAdmin(playerid) && PlayerInfo[playerid][pAdminLevel] >= 1) it would be if(PlayerInfo[playerid][pAdminLevel] >= 1).

$India$
10/10/2011, 05:27 AM
Ok..

DaRkAnGeL[NBK]
10/10/2011, 08:01 PM
guys didnt work is till get errors -.-

GrimR
10/10/2011, 08:39 PM
So this is no good:


CMD:setvip(playerid, params[])
{
new id, level;

if (PlayerInfo[playerid][pAdminLevel] >= 1) { return SendClientMessage(playerid, -1, "You are not an admin."); }
if (sscanf(params, "ui", id, level) { return SendClientMessage(playerid, -1, "SYNTAX: /setvip, [id] [level]"); }
if (id == INVALID_PLAYER_ID { return SendClientMessage(playerid, -1, "No player online with that ID."); }

PlayerInfo[id][pVip] = level;

return 1;
}


?