[HELP] My Pawno doesn't compile!
#1

(1st solved ^^)

2nd problem -_-:
i have a question about something i didn't find on internet: if i want to make a command admin only, do i need to put if(PlayerInfo[playerid][Level] >= 1) in front of it?

EXAMPLE:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(PlayerInfo[playerid][Level] >= 1)
if (strcmp(cmdtext, "/closegarage", true) == 0){
MoveObject(gate2, -1371.383057, 922.077637, 5.851798,2);
return 1;
}
if(PlayerInfo[playerid][Level] >= 1)
if (strcmp(cmdtext, "/opengarage", true) == 0){
MoveObject(gate2, -1371.383057, 922.077637, -2.851798,2);
return 1;
}
if(PlayerInfo[playerid][Level] >= 1)
if (strcmp(cmdtext, "/closegate", true) == 0){
MoveObject(gate1, -1465.871216, 1007.168152, 8.958706,2);
return 1;
}
if(PlayerInfo[playerid][Level] >= 1)
if (strcmp(cmdtext, "/opengate", true) == 0){
MoveObject(gate1, -1465.871216, 1007.168152, 1.958706,2);
return 1;
}
}

what did i do wrong??
Reply
#2

u know the folder u launch ur server from , rename it to anything like from : samp-server to server or samp . anything
________
MOTORCYCLE TIRES
Reply
#3

^^ thanks, now it works
Reply
#4

np
________
thai girl Webcams
Reply
#5

1) You missed a curly bracket at the end of this line: [pawno] if(PlayerInfo[playerid][Level] >= 1) [/pawno]
2) Do you have an array called PlayerInfo made? Or are you just seeing it in other scripts and thinking it's native?
3) And more.

[pawno]public OnPlayerCommandText(playerid, cmdtext[])
{
// CLOSE GARAGE
if (strcmp(cmdtext, "/closegarage", true) == 0)
{
if(PlayerInfo[playerid][Level] > 0)
{
MoveObject(gate2, -1371.383057, 922.077637, 5.851798,2);
SendClientMessage(playerid, 0xFFCCFFFF, "The garage was closed.");
return 1;
}
else
{
SendClientMessage(playerid, 0xCCFFFFFF, "You are not an administrator; garage was not closed.");
return 1;
}
}
// OPEN GARAGE
if (strcmp(cmdtext, "/opengarage", true) == 0)
{
if(PlayerInfo[playerid][Level] > 0)
{
MoveObject(gate2, -1371.383057, 922.077637, -2.851798,2);
SendClientMessage(playerid, 0xFFCCFFFF, "The garage was opened.");
return 1;
}
else
{
SendClientMessage(playerid, 0xCCFFFFFF, "You are not an administrator; garage was not opened.");
return 1;
}
}
// CLOSE GATE
if (strcmp(cmdtext, "/closegate", true) == 0)
{
if(PlayerInfo[playerid][Level] > 0)
{
MoveObject(gate1, -1465.871216, 1007.168152, 8.958706,2);
SendClientMessage(playerid, 0xFFCCFFFF, "The gate was closed.");
return 1;
}
else
{
SendClientMessage(playerid, 0xCCFFFFFF, "You are not an administrator; gate was not closed.");
return 1;
}
}
// OPEN GATE
if (strcmp(cmdtext, "/opengate", true) == 0)
{
if(PlayerInfo[playerid][Level] > 0)
{
MoveObject(gate1, -1465.871216, 1007.168152, 1.958706,2);
SendClientMessage(playerid, 0xFFCCFFFF, "The gate was opened.");
return 1;
}
else
{
SendClientMessage(playerid, 0xCCFFFFFF, "You are not an administrator; gate was not opened.");
return 1;
}
}
}[/pawno]

Try that.
Reply
#6

^^ thanks. and to help u out: it's (CODE) and not (PAWNO)

(change ( to [ and ) to ])
Reply
#7

Wait I think i got it now.
Reply
#8

The player level would go after the CMD. STRCMP starts broad. Then, the more you indent, the more specific/in depth you get.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)