SA-MP Forums Archive
Setadminname - 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: Setadminname (/showthread.php?tid=476689)



Setadminname - TonyNames - 19.11.2013

Hello a friend send me a /setadminname system but i got some error here are they


Quote:

C:\Users\JakkenKoppen\Desktop\Working scripts\Scripts\Bone County Script\gamemodes\UGRP.pwn(3430) : warning 235: public function lacks forward declaration (symbol "Audio_OnSetPack")
C:\Users\JakkenKoppen\Desktop\Working scripts\Scripts\Bone County Script\gamemodes\UGRP.pwn(8937 : error 017: undefined symbol "AdminDuty"
C:\Users\JakkenKoppen\Desktop\Working scripts\Scripts\Bone County Script\gamemodes\UGRP.pwn(8937 : warning 215: expression has no effect
C:\Users\JakkenKoppen\Desktop\Working scripts\Scripts\Bone County Script\gamemodes\UGRP.pwn(8937 : error 001: expected token: ";", but found "]"
C:\Users\JakkenKoppen\Desktop\Working scripts\Scripts\Bone County Script\gamemodes\UGRP.pwn(8937 : error 029: invalid expression, assumed zero
C:\Users\JakkenKoppen\Desktop\Working scripts\Scripts\Bone County Script\gamemodes\UGRP.pwn(8937 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Here are the system

Quote:

CMDetadminname(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 9999
{
/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 99999)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}*/

new giveplayerid, name[32];
if(sscanf(params, "us[32]", giveplayerid, name))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadminname [playerid/partofname] [name]");
return 1;
}

if(PlayerInfo[giveplayerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "The player is not an admin.");
return 1;
}

if(AdminDuty[giveplayerid] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");
return 1;
}

new length = strlen(name);
if(length < 3 || length > 20)
{
SendClientMessage(playerid, COLOR_WHITE, "The name can't less than 3 characters or more than 20 characters.");
return 1;
}

if(strfind(name, "_", true) != -1)
{
SendClientMessage(playerid, COLOR_WHITE, "The admin name must be one name. There can't be an underscore in the name.");
return 1;
}

if(strcmp(name, "Zhao", true) == 0 && PlayerInfo[playerid][pAdmin] < 99999) {
SendClientMessage(playerid, COLOR_WHITE, "stop ! im zao ! you're not zao !");
return 1;
}

new string[128];
format(string, sizeof(string), "AdmCmd: %s has set %s's admin name to '%s'.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), name);
ABroadCast(COLOR_LIGHTRED, string, 1);

format(PlayerInfo[giveplayerid][pAdminName], 32, name);
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}

CMD:adminduty(playerid, params[]) {
return cmd_aduty(playerid, params);
}

CMD:reportsold(playerid, params[]) {
return cmd_reports(playerid, params);
}

CMD:aduty(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 2) {
if(strlen(PlayerInfo[playerid][pAdminName]) > 2 && strlen(PlayerInfo[playerid][pAdminName]) < 20) {
new string[128];
if(AdminDuty[playerid] != 0) {
if(!doesAccountExist(PlayerInfo[playerid][pAdminName])) {
if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 2) {
GettingSpectated[Spectate[playerid]] = 999;
Spectating[playerid] = 0;
Spectate[playerid] = 999;
SetPVarInt(playerid, "SpecOff", 1);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
}

new pState = GetPlayerState(playerid);

if(pState == PLAYER_STATE_WASTED) {
SendClientMessage(playerid, COLOR_GRAD2, "You can't do this while wasted.");
return 1;
}

DeletePVar(playerid, "MedicBill");
DeletePVar(playerid, "HospitalTimer");
DeletePVar(playerid, "Hospital");
DeletePVar(playerid, "Injured");
DeletePVar(playerid, "EMSAttempt");
DeletePVar(playerid, "MedicCall");

TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
PlayerCuffed[playerid] = 0;
PlayerCuffedTime[playerid] = 0;
DeletePVar(playerid, "PlayerCuffed");
HouseOffer[playerid] = 999;
House[playerid] = 0;
HousePrice[playerid] = 0;
SexOffer[playerid] = 999;
SexPrice[playerid] = 0;
InviteOffer[playerid]=999;
InviteFaction[playerid]=0;
InviteFamily[playerid]=255;
PotOffer[playerid] = 999;
CrackOffer[playerid] = 999;
PotPrice[playerid]=0;
CrackPrice[playerid]=0;
PotGram[playerid]=0;
CrackGram[playerid]=0;
JailPrice[playerid]=0;
DefendOffer[playerid] = 999;
DefendPrice[playerid] = 0;
GuardOffer[playerid] = 999;
GuardPrice[playerid]=0;
GunOffer[playerid] = 999;
GunId[playerid] = 0;
GunMats[playerid] = 0;
MatsOffer[playerid] = 999;
MatsPrice[playerid] = 0;
MatsAmount[playerid] = 0;
CraftOffer[playerid] = 999;
CraftId[playerid]=0;
CraftMats[playerid]=0;
VehicleOffer[playerid] = 999;
VehiclePrice[playerid] = 0;
VehicleId[playerid] = -1;
RepairCar[playerid]=0;
OnDuty[playerid]=0;
TicketOffer[playerid] = 999;
TicketMoney[playerid] = 0;
arr_Towing[playerid] = INVALID_VEHICLE_ID;
GotHit[playerid]=0;
GoChase[playerid]=999;
GetChased[playerid]=999;
DivorceOffer[playerid] = 999;
MarryWitness[playerid] = 999;
MarryWitnessOffer[playerid] = 999;
MarriageCeremoney[playerid] = 0;
ProposeOffer[playerid] = 999;
ProposedTo[playerid] = 999;
GotProposedBy[playerid] = 999;

SetPVarInt(playerid, "washereforpaycheck", WasHereForPaycheck[playerid]);
SetPVarInt(playerid, "signedpaycheck", SignedPaycheck[playerid]);
SetPVarInt(playerid, "missedpaychecks", MissedPaychecks[playerid]);
SetPVarInt(playerid, "paycheckcode", PayCheckCode[playerid]);
SetPVarInt(playerid, "payready", PlayerInfo[playerid][pPayReady]);
SetPVarInt(playerid, "paycheck", PlayerInfo[playerid][pPayCheck]);

WasHereForPaycheck[playerid] = 0;
SignedPaycheck[playerid] = 0;
MissedPaychecks[playerid] = 0;
PayCheckCode[playerid] = 0;
DeletePVar(playerid, "LAPCReceived");
PhoneOnline[playerid] = 0;

DeletePVar(playerid, "AdminUndercover");

new username[MAX_PLAYER_NAME];
GetPVarString(playerid, "TempNameName", username, sizeof(username));
SetPVarInt(playerid, "TempName", 0);
SetPlayerName(playerid, username);

AdminDuty[playerid] = 0;
format(string, sizeof(string), "%s (ID %d - %s) is now off-duty as a Level %d Admin.", PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
ABroadCast(COLOR_WHITE, string, 1);

if(PlayerInfo[playerid][pAdmin] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, but still have access to your Level 1 Admin commands.");
}
if(PlayerInfo[playerid][pAdmin] > 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, and only have access to /admins /check /jail /ban /sban /kick /skick /showflags /reports /nrn");
}
if(PlayerInfo[playerid][pAdmin] == 6)
{
SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, but still have access to all of your commands since you're a Level 6 Admin.");
}
SendClientMessage(playerid, COLOR_REALRED, "Please remember to turn off any hacks you may have (press F12 to disable ******).");

//SetPVarInt(playerid, "F12Timer", SetTimerEx("F12Warning", 1000, true, "d", playerid));

OnPlayerLogin(playerid, AdminRelogPassword[playerid]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmourEx(playerid, PlayerInfo[playerid][pArmor]);

// Return paycheck stats
WasHereForPaycheck[playerid] = GetPVarInt(playerid, "washereforpaycheck");
SignedPaycheck[playerid] = GetPVarInt(playerid, "signedpaycheck");
MissedPaychecks[playerid] = GetPVarInt(playerid, "missedpaychecks");
PayCheckCode[playerid] = GetPVarInt(playerid, "paycheckcode");
PlayerInfo[playerid][pPayReady] = GetPVarInt(playerid, "payready");
PlayerInfo[playerid][pPayCheck] = GetPVarInt(playerid, "paycheck");

// Clear these vars from memory, since we don't need 'em any more
DeletePVar(playerid, "washereforpaycheck");
DeletePVar(playerid, "signedpaycheck");
DeletePVar(playerid, "missedpaychecks");
DeletePVar(playerid, "paycheckcode");
DeletePVar(playerid, "payready");
DeletePVar(playerid, "paycheck");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "This name is already registered.");
}
}
else
{
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32);
GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);
OnPlayerStatsUpdate(playerid);

PhoneOnline[playerid] = 1;

for(new i = 0; i < MAX_REPORTS; i++)
{
if(Reports[i][ReportFrom] == playerid)
{
Reports[i][ReportFrom] = 999;
Reports[i][BeingUsed] = 0;
Reports[i][TimeToExpire] = 0;
}
}

if(GotHit[playerid] > 0)
{
if(GetChased[playerid] < 999)
{
if(IsPlayerConnected(GetChased[playerid]))
{
SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Your hit has left the server.");
GoChase[GetChased[playerid]] = 999;
}
}
}
if(GoChase[playerid] < 999)
{
GetChased[GoChase[playerid]] = 999;
GotHit[GoChase[playerid]] = 999;
}

SetPVarInt(playerid, "TempName", 1);
new username[MAX_PLAYER_NAME];
GetPlayerName(playerid, username, sizeof(username));
SetPVarString(playerid, "TempNameName", username);

AdminDuty[playerid] = 1;
format(string, sizeof(string), "%s (ID %d - %s) is now on-duty as a Level %d Admin.",PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
ABroadCast(COLOR_WHITE, string, 1);
SendClientMessage(playerid, COLOR_YELLOW, "You're now on-duty as admin and have access to all your commands, see /ah.");

SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
}
}
else SendClientMessage(playerid, COLOR_WHITE, "You need an admin name to go on-duty. Contact a Level 5+ Admin to have your admin name set.");
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}




Re: Setadminname - TonyNames - 20.11.2013

Anyone?


Re: Setadminname - kbalor - 20.11.2013

Could you please show us the which line error occurs?


Re: Setadminname - TonyNames - 20.11.2013

Sure


Re: Setadminname - TonyNames - 20.11.2013

Quote:

C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89355) : error 017: undefined symbol "AdminDuty"

Quote:

C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89355) : error 001: expected token: ";", but found "]"

Quote:

C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89355) : error 029: invalid expression, assumed zero
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89355) : fatal error 107: too many error messages on one line

Quote:

if(AdminDuty[giveplayerid] != 0)

Here are they


Re: Setadminname - TonyNames - 21.11.2013

Cmon anyone?


Re: Setadminname - xFallen - 21.11.2013

Line #89355 - Add AdminDuty on player stats.
Line #89355 - You are missing a ';'

Код:
if(PlayerInfo[AdminDuty][giveplayerid] == 0)
{ 
//    what ever you want. 
      return 1; 
}
OR

Код:
if(PlayerStat[AdminDuty][giveplayerid] == 0)
{ 
//     what ever you want here. 
       return 1; 
}
Depends on your script which i have to say written very stupidly and unorganized.


Re: Setadminname - TonyNames - 21.11.2013

Now i got all these errors

Quote:

C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(3433) : warning 235: public function lacks forward declaration (symbol "Audio_OnSetPack")
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89355) : error 017: undefined symbol "AdminDuty"
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89397) : error 017: undefined symbol "AdminDuty"
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89397) : warning 215: expression has no effect
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89397) : error 001: expected token: ";", but found "]"
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89397) : error 029: invalid expression, assumed zero
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89397) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Line 89355
Quote:

if(PlayerInfo[AdminDuty][giveplayerid] == 0)

Line 89397
Quote:

if(AdminDuty[playerid] != 0) {

Can you guys give me a define of the AdminDuty?


Re: Setadminname - newbie scripter - 21.11.2013

new AdminDuty[MAX_PLAYERS]


Re: Setadminname - TonyNames - 21.11.2013

New errors

Quote:

C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(3435) : warning 235: public function lacks forward declaration (symbol "Audio_OnSetPack")
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89357) : error 033: array must be indexed (variable "AdminDuty")
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89476) : error 017: undefined symbol "WasHereForPaycheck"
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89476) : warning 215: expression has no effect
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89476) : error 001: expected token: ";", but found "]"
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89476) : error 029: invalid expression, assumed zero
C:\Users\JakkenKoppen\Desktop\o\Bone County Script\gamemodes\UGRP.pwn(89476) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

89357
Quote:

if(PlayerInfo[AdminDuty][giveplayerid] == 0)

89476
Quote:

SetPVarInt(playerid, "washereforpaycheck", WasHereForPaycheck[playerid]);