07.11.2010, 16:34
Ofcourse.
The OnPlayerCommandText() (quite a few lines lol)
The new commands:
EDIT: Guess I found it,
new cmd[256], string[128], tmp[256], idx; means the second number in dcmd equals to the length of the command, will try out now.
The OnPlayerCommandText() (quite a few lines lol)
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(PlayerInfo[playerid][Jailed] == 1 && PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid,red,"You cannot use commands in jail"); new cmd[256], string[128], tmp[256], idx; cmd = strtok(cmdtext, idx); #if defined USE_AREGISTER dcmd(aregister,9,cmdtext); dcmd(alogin,6,cmdtext); dcmd(achangepass,11,cmdtext); dcmd(asetpass,8,cmdtext); #if defined USE_STATS dcmd(astats,6,cmdtext); dcmd(aresetstats,11,cmdtext); #endif #else dcmd(register,8,cmdtext); dcmd(login,5,cmdtext); dcmd(changepass,10,cmdtext); dcmd(setpass,7,cmdtext); #if defined USE_STATS dcmd(stats,5,cmdtext); dcmd(resetstats,10,cmdtext); #endif #endif dcmd(report,6,cmdtext); dcmd(reports,7,cmdtext); //================ [ Read Comamands ] ===========================// if(ServerInfo[ReadCmds] == 1) { format(string, sizeof(string), "*** %s (%d) typed: %s", pName(playerid),playerid,cmdtext); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if( (PlayerInfo[i][Level] > PlayerInfo[playerid][Level]) && (PlayerInfo[i][Level] > 1) && (i != playerid) ) { SendClientMessage(i, grey, string); } } } } //-= Spectate Commands =-// #if defined ENABLE_SPEC dcmd(lspec,5,cmdtext); dcmd(lspecoff,8,cmdtext); dcmd(lspecvehicle,12,cmdtext); #endif //-= Chat Commands =-// dcmd(disablechat,11,cmdtext); dcmd(clearchat,9,cmdtext); dcmd(clearallchat,12,cmdtext); dcmd(caps,4,cmdtext); //-= Vehicle Commands =-// dcmd(destroycar,10,cmdtext); dcmd(lockcar,7,cmdtext); dcmd(unlockcar,9,cmdtext); dcmd(carhealth,9,cmdtext); dcmd(carcolour,9,cmdtext); dcmd(car,3,cmdtext); dcmd(vr,2,cmdtext); dcmd(fix,3,cmdtext); dcmd(repair,6,cmdtext); dcmd(ltune,5,cmdtext); dcmd(lhy,3,cmdtext); dcmd(lcar,4,cmdtext); dcmd(lbike,5,cmdtext); dcmd(lheli,5,cmdtext); dcmd(lboat,5,cmdtext); dcmd(lnos,4,cmdtext); dcmd(lplane,6,cmdtext); dcmd(vgoto,5,cmdtext); dcmd(vget,4,cmdtext); dcmd(givecar,7,cmdtext); dcmd(givebike,7,cmdtext); dcmd(giveboat,7,cmdtext); dcmd(giveplane,7,cmdtext); dcmd(giveheli,7,cmdtext); dcmd(flip,4,cmdtext); dcmd(ltc,3,cmdtext); dcmd(linkcar,7,cmdtext); //-= Playerid Commands =-// dcmd(crash,5,cmdtext); dcmd(ip,2,cmdtext); dcmd(force,5,cmdtext); dcmd(burn,4,cmdtext); dcmd(spawn,5,cmdtext); dcmd(spawnplayer,11,cmdtext); dcmd(disarm,6,cmdtext); dcmd(eject,5,cmdtext); dcmd(bankrupt,8,cmdtext); dcmd(sbankrupt,9,cmdtext); dcmd(setworld,8,cmdtext); dcmd(setinterior,11,cmdtext); dcmd(ubound,6,cmdtext); dcmd(setwanted,9,cmdtext); dcmd(setcolour,9,cmdtext); dcmd(settime,7,cmdtext); dcmd(setweather,10,cmdtext); dcmd(setname,7,cmdtext); dcmd(setskin,7,cmdtext); dcmd(setscore,8,cmdtext); dcmd(setcash,7,cmdtext); dcmd(sethealth,9,cmdtext); dcmd(setarmour,9,cmdtext); dcmd(giveweapon,10,cmdtext); dcmd(warp,4,cmdtext); dcmd(teleplayer,10,cmdtext); dcmd(goto,4,cmdtext); dcmd(gethere,7,cmdtext); dcmd(get,3,cmdtext); dcmd(setlevel,8,cmdtext); dcmd(settemplevel,12,cmdtext); dcmd(fu,2,cmdtext); dcmd(warn,4,cmdtext); dcmd(kick,4,cmdtext); dcmd(ban,3,cmdtext); dcmd(rban,4,cmdtext); dcmd(slap,4,cmdtext); dcmd(explode,7,cmdtext); dcmd(jail,4,cmdtext); dcmd(unjail,6,cmdtext); dcmd(jailed,6,cmdtext); dcmd(freeze,6,cmdtext); dcmd(unfreeze,8,cmdtext); dcmd(frozen,6,cmdtext); dcmd(mute,4,cmdtext); dcmd(unmute,6,cmdtext); dcmd(muted,5,cmdtext); dcmd(akill,5,cmdtext); dcmd(weaps,5,cmdtext); dcmd(screen,6,cmdtext); dcmd(lgoto,5,cmdtext); dcmd(aka,3,cmdtext); dcmd(highlight,9,cmdtext); //-= /All Commands =-// dcmd(healall,7,cmdtext); dcmd(armourall,9,cmdtext); dcmd(muteall,7,cmdtext); dcmd(unmuteall,9,cmdtext); dcmd(killall,7,cmdtext); dcmd(getall,6,cmdtext); dcmd(spawnall,8,cmdtext); dcmd(freezeall,9,cmdtext); dcmd(unfreezeall,11,cmdtext); dcmd(explodeall,10,cmdtext); dcmd(kickall,7,cmdtext); dcmd(slapall,7,cmdtext); dcmd(ejectall,8,cmdtext); dcmd(disarmall,9,cmdtext); dcmd(setallskin,10,cmdtext); dcmd(setallwanted,12,cmdtext); dcmd(setallweather,13,cmdtext); dcmd(setalltime,10,cmdtext); dcmd(setallworld,11,cmdtext); dcmd(setallscore,11,cmdtext); dcmd(setallcash,10,cmdtext); dcmd(giveallcash,11,cmdtext); dcmd(giveallweapon,13,cmdtext); //-= No params =-// dcmd(lslowmo,7,cmdtext); dcmd(lweaps,6,cmdtext); dcmd(lammo,5,cmdtext); dcmd(god,3,cmdtext); dcmd(sgod,4,cmdtext); dcmd(godcar,6,cmdtext); dcmd(die,3,cmdtext); dcmd(jetpack,7,cmdtext); dcmd(admins,6,cmdtext); dcmd(morning,7,cmdtext); //-= Admin special =-// dcmd(saveplace,9,cmdtext); dcmd(gotoplace,9,cmdtext); dcmd(saveskin,8,cmdtext); dcmd(useskin,7,cmdtext); dcmd(dontuseskin,11,cmdtext); //-= Config =-// dcmd(disable,7,cmdtext); dcmd(enable,6,cmdtext); dcmd(setping,7,cmdtext); dcmd(setgravity,10,cmdtext); dcmd(uconfig,7,cmdtext); dcmd(lconfig,7,cmdtext); dcmd(forbidname,10,cmdtext); dcmd(forbidword,10,cmdtext); //-= Misc =-// dcmd(setmytime,9,cmdtext); dcmd(kill,4,cmdtext); dcmd(dosuicide,4,cmdtext); dcmd(time,4,cmdtext); dcmd(lhelp,5,cmdtext); dcmd(lcmds,5,cmdtext); dcmd(lcommands,9,cmdtext); dcmd(level1,6,cmdtext); dcmd(level2,6,cmdtext); dcmd(level3,6,cmdtext); dcmd(level4,6,cmdtext); dcmd(level5,6,cmdtext); dcmd(lcredits,8,cmdtext); dcmd(serverinfo,10,cmdtext); dcmd(getid,5,cmdtext); dcmd(getinfo,7,cmdtext); dcmd(laston,6,cmdtext); dcmd(ping,4,cmdtext); dcmd(countdown,9,cmdtext); dcmd(duel,4,cmdtext); dcmd(asay,4,cmdtext); dcmd(say,4,cmdtext); dcmd(password,8,cmdtext); dcmd(lockserver,10,cmdtext); dcmd(unlockserver,12,cmdtext); dcmd(adminarea,9,cmdtext); dcmd(announce,8,cmdtext); dcmd(announce2,9,cmdtext); dcmd(richlist,8,cmdtext); dcmd(miniguns,8,cmdtext); dcmd(botcheck,8,cmdtext); dcmd(object,6,cmdtext); dcmd(pickup,6,cmdtext); dcmd(move,4,cmdtext); dcmd(moveplayer,10,cmdtext); #if defined ENABLE_FAKE_CMDS dcmd(fakedeath,9,cmdtext); dcmd(fakechat,8,cmdtext); dcmd(fakecmd,7,cmdtext); #endif //-= Menu Commands =-// #if defined USE_MENUS dcmd(lmenu,5,cmdtext); dcmd(ltele,5,cmdtext); dcmd(lvehicle,8,cmdtext); dcmd(lweapons,8,cmdtext); dcmd(lweather,8,cmdtext); dcmd(ltmenu,6,cmdtext); dcmd(ltime,5,cmdtext); dcmd(cm,2,cmdtext); #endif //========================= [ Car Commands ]==================================== if(strcmp(cmdtext, "/ltunedcar2", true)==0 || strcmp(cmdtext, "/ltc2", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,LVehicleIDt; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); LVehicleIDt = CreateVehicle(560,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,LVehicleIDt,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(LVehicleIDt, 1028); AddVehicleComponent(LVehicleIDt, 1030); AddVehicleComponent(LVehicleIDt, 1031); AddVehicleComponent(LVehicleIDt, 1138); AddVehicleComponent(LVehicleIDt, 1140); AddVehicleComponent(LVehicleIDt, 1170); AddVehicleComponent(LVehicleIDt, 1028); AddVehicleComponent(LVehicleIDt, 1030); AddVehicleComponent(LVehicleIDt, 1031); AddVehicleComponent(LVehicleIDt, 1138); AddVehicleComponent(LVehicleIDt, 1140); AddVehicleComponent(LVehicleIDt, 1170); AddVehicleComponent(LVehicleIDt, 1080); AddVehicleComponent(LVehicleIDt, 1086); AddVehicleComponent(LVehicleIDt, 1087); AddVehicleComponent(LVehicleIDt, 1010); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); ChangeVehiclePaintjob(LVehicleIDt,1); SetVehicleVirtualWorld(LVehicleIDt, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(LVehicleIDt, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = LVehicleIDt; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar3", true)==0 || strcmp(cmdtext, "/ltc3", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,LVehicleIDt; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); LVehicleIDt = CreateVehicle(560,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,LVehicleIDt,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(LVehicleIDt, 1028); AddVehicleComponent(LVehicleIDt, 1030); AddVehicleComponent(LVehicleIDt, 1031); AddVehicleComponent(LVehicleIDt, 1138); AddVehicleComponent(LVehicleIDt, 1140); AddVehicleComponent(LVehicleIDt, 1170); AddVehicleComponent(LVehicleIDt, 1080); AddVehicleComponent(LVehicleIDt, 1086); AddVehicleComponent(LVehicleIDt, 1087); AddVehicleComponent(LVehicleIDt, 1010); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); ChangeVehiclePaintjob(LVehicleIDt,2); SetVehicleVirtualWorld(LVehicleIDt, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(LVehicleIDt, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = LVehicleIDt; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar4", true)==0 || strcmp(cmdtext, "/ltc4", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(559,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1065); AddVehicleComponent(carid,1067); AddVehicleComponent(carid,1162); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar5", true)==0 || strcmp(cmdtext, "/ltc5", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(565,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1046); AddVehicleComponent(carid,1049); AddVehicleComponent(carid,1053); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar6", true)==0 || strcmp(cmdtext, "/ltc6", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(558,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1088); AddVehicleComponent(carid,1092); AddVehicleComponent(carid,1139); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar7", true)==0 || strcmp(cmdtext, "/ltc7", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(561,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1055); AddVehicleComponent(carid,1058); AddVehicleComponent(carid,1064); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar8", true)==0 || strcmp(cmdtext, "/ltc8", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(562,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1034); AddVehicleComponent(carid,1038); AddVehicleComponent(carid,1147); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar9", true)==0 || strcmp(cmdtext, "/ltc9", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(567,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1102); AddVehicleComponent(carid,1129); AddVehicleComponent(carid,1133); AddVehicleComponent(carid,1186); AddVehicleComponent(carid,1188); ChangeVehiclePaintjob(carid,1); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1085); AddVehicleComponent(carid,1087); AddVehicleComponent(carid,1086); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar10", true)==0 || strcmp(cmdtext, "/ltc10", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(558,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1092); AddVehicleComponent(carid,1166); AddVehicleComponent(carid,1165); AddVehicleComponent(carid,1090); AddVehicleComponent(carid,1094); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1087); AddVehicleComponent(carid,1163);//SPOILER AddVehicleComponent(carid,1091); ChangeVehiclePaintjob(carid,2); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar11", true)==0 || strcmp(cmdtext, "/ltc11", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(557,X,Y,Z,Angle,1,1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1081); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar12", true)==0 || strcmp(cmdtext, "/ltc12", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,red,"Error: You already have a vehicle"); } else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(535,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); ChangeVehiclePaintjob(carid,1); AddVehicleComponent(carid,1109); AddVehicleComponent(carid,1115); AddVehicleComponent(carid,1117); AddVehicleComponent(carid,1073); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1087); AddVehicleComponent(carid,1114); AddVehicleComponent(carid,1081); AddVehicleComponent(carid,1119); AddVehicleComponent(carid,1121); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmdtext, "/ltunedcar13", true)==0 || strcmp(cmdtext, "/ltc13", true)==0) { if(PlayerInfo[playerid][Level] >= 1) { if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,red,"Error: You already have a vehicle"); else { if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]); new Float:X,Float:Y,Float:Z,Float:Angle,carid; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); carid = CreateVehicle(562,X,Y,Z,Angle,1,-1,-1); PutPlayerInVehicle(playerid,carid,0); CMDMessageToAdmins(playerid,"LTunedCar"); AddVehicleComponent(carid,1034); AddVehicleComponent(carid,1038); AddVehicleComponent(carid,1147); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,0); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); PlayerInfo[playerid][pCar] = carid; } } else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); return 1; } //------------------------------------------------------------------------------ if(strcmp(cmd, "/lp", true) == 0) { if(PlayerInfo[playerid][Level] >= 1) { if (GetPlayerState(playerid) == 2) { new VehicleID = GetPlayerVehicleID(playerid), LModel = GetVehicleModel(VehicleID); switch(LModel) { case 448,461,462,463,468,471,509,510,521,522,523,581,586, 449: return SendClientMessage(playerid,red,"ERROR: You can not tune this vehicle"); } new str[128], Float:pos[3]; format(str, sizeof(str), "%s", cmdtext[2]); SetVehicleNumberPlate(VehicleID, str); GetPlayerPos(playerid, pos[0], pos[1], pos[2]); SetPlayerPos(playerid, pos[0]+1, pos[1], pos[2]); SetVehicleToRespawn(VehicleID); SetVehiclePos(VehicleID, pos[0], pos[1], pos[2]); SetTimerEx("TuneLCar",4000,0,"d",VehicleID); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid, blue, "You have changed your licence plate"); CMDMessageToAdmins(playerid,"LP"); } else { SendClientMessage(playerid,red,"Error: You have to be the driver of a vehicle to change its licence plate"); } } else { SendClientMessage(playerid,red,"ERROR: You need to be level 1 use this command"); } return 1; } //------------------------------------------------------------------------------ if(strcmp(cmd, "/spam", true) == 0) { if(PlayerInfo[playerid][Level] >= 5) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, red, "USAGE: /spam [Colour] [Text]"); SendClientMessage(playerid, red, "Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink"); return 1; } new Colour = strval(tmp); if(Colour > 9 ) return SendClientMessage(playerid, red, "Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink"); tmp = strtok(cmdtext, idx); format(string,sizeof(string),"%s",cmdtext[8]); if(Colour == 0) for(new i; i < 50; i++) SendClientMessageToAll(black,string); else if(Colour == 1) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_WHITE,string); else if(Colour == 2) for(new i; i < 50; i++) SendClientMessageToAll(red,string); else if(Colour == 3) for(new i; i < 50; i++) SendClientMessageToAll(orange,string); else if(Colour == 4) for(new i; i < 50; i++) SendClientMessageToAll(yellow,string); else if(Colour == 5) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_GREEN1,string); else if(Colour == 6) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_BLUE,string); else if(Colour == 7) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_PURPLE,string); else if(Colour == 8) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_BROWN,string); else if(Colour == 9) for(new i; i < 50; i++) SendClientMessageToAll(COLOR_PINK,string); return 1; } else return SendClientMessage(playerid,red,"ERROR: You need to be level 5 to use this command"); } //------------------------------------------------------------------------------ if(strcmp(cmd, "/write", true) == 0) { if(PlayerInfo[playerid][Level] >= 2) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, red, "USAGE: /write [Colour] [Text]"); return SendClientMessage(playerid, red, "Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink"); } new Colour; Colour = strval(tmp); if(Colour > 9 ) { SendClientMessage(playerid, red, "USAGE: /write [Colour] [Text]"); return SendClientMessage(playerid, red, "Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink"); } tmp = strtok(cmdtext, idx); CMDMessageToAdmins(playerid,"WRITE"); if(Colour == 0) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(black,string); return 1; } else if(Colour == 1) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(COLOR_WHITE,string); return 1; } else if(Colour == 2) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(red,string); return 1; } else if(Colour == 3) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(orange,string); return 1; } else if(Colour == 4) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(yellow,string); return 1; } else if(Colour == 5) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(COLOR_GREEN1,string); return 1; } else if(Colour == 6) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(COLOR_BLUE,string); return 1; } else if(Colour == 7) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(COLOR_PURPLE,string); return 1; } else if(Colour == 8) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(COLOR_BROWN,string); return 1; } else if(Colour == 9) { format(string,sizeof(string),"%s",cmdtext[9]); SendClientMessageToAll(COLOR_PINK,string); return 1; } return 1; } else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command"); } //------------------------------------------------------------------------------ // Remote Console //------------------------------------------------------------------------------ if(strcmp(cmd, "/loadfs", true) == 0) { if(PlayerInfo[playerid][Level] >= 5) { new str[128]; format(str,sizeof(string),"%s",cmdtext[1]); SendRconCommand(str); return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } if(strcmp(cmd, "/unloadfs", true) == 0) { if(PlayerInfo[playerid][Level] >= 5) { new str[128]; format(str,sizeof(string),"%s",cmdtext[1]); SendRconCommand(str); return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } if(strcmp(cmd, "/changemode", true) == 0) { if(PlayerInfo[playerid][Level] >= 4) { new str[128]; format(str,sizeof(string),"%s",cmdtext[1]); SendRconCommand(str); return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } if(strcmp(cmd, "/gmx", true) == 0) { if(PlayerInfo[playerid][Level] >= 5) { OnFilterScriptExit(); SetTimer("RestartGM",5000,0); return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } if(strcmp(cmd, "/loadladmin", true) == 0) { if(PlayerInfo[playerid][Level] >= 5) { SendRconCommand("loadfs ladmin4"); return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } if(strcmp(cmd, "/unloadladmin", true) == 0) { if(PlayerInfo[playerid][Level] >= 5) { SendRconCommand("unloadfs ladmin4"); return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } if(strcmp(cmd, "/reloadladmin", true) == 0) { if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid) ) { SendRconCommand("reloadfs ladmin4"); SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent"); return CMDMessageToAdmins(playerid,"RELOADLADMIN"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } return SendClientMessage(playerid, red, "Sorry, this command doesn't exist."); } //============================================================================== #if defined ENABLE_SPEC public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { new x = 0; while(x!=MAX_PLAYERS) { if( IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER ) { SetPlayerInterior(x,newinteriorid); } x++; } } //============================================================================== public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID) { if(newkeys == KEY_JUMP) AdvanceSpectate(playerid); else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid); } return 1; } //============================================================================== public OnPlayerEnterVehicle(playerid, vehicleid) { for(new x=0; x<MAX_PLAYERS; x++) { if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid) { TogglePlayerSpectating(x, 1); PlayerSpectateVehicle(x, vehicleid); PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE; } } return 1; } //============================================================================== public OnPlayerStateChange(playerid, newstate, oldstate) { switch(newstate) { case PLAYER_STATE_ONFOOT: { switch(oldstate) { case PLAYER_STATE_DRIVER: OnPlayerExitVehicle(playerid,255); case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle(playerid,255); } } } return 1; }
Код:
dcmd_givebike(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) { if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /givecar [playerid]"); new player1 = strval(params), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); if(IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle"); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) { CMDMessageToAdmins(playerid,"GIVECAR"); new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); CarSpawner(player1,522); GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); format(string,sizeof(string),"Administrator %s has given you a car",adminname); SendClientMessage(player1,blue,string); format(string,sizeof(string),"You have given %s a car", playername); return SendClientMessage(playerid,blue,string); } else return SendClientMessage(playerid, red, "Player is not connected or is yourself"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } dcmd_giveboat(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) { if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /givecar [playerid]"); new player1 = strval(params), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); if(IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle"); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) { CMDMessageToAdmins(playerid,"GIVECAR"); new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); CarSpawner(player1,452); GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); format(string,sizeof(string),"Administrator %s has given you a car",adminname); SendClientMessage(player1,blue,string); format(string,sizeof(string),"You have given %s a car", playername); return SendClientMessage(playerid,blue,string); } else return SendClientMessage(playerid, red, "Player is not connected or is yourself"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } dcmd_giveplane(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) { if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /givecar [playerid]"); new player1 = strval(params), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); if(IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle"); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) { CMDMessageToAdmins(playerid,"GIVECAR"); new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); CarSpawner(player1,511); GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); format(string,sizeof(string),"Administrator %s has given you a car",adminname); SendClientMessage(player1,blue,string); format(string,sizeof(string),"You have given %s a car", playername); return SendClientMessage(playerid,blue,string); } else return SendClientMessage(playerid, red, "Player is not connected or is yourself"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } dcmd_giveheli(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) { if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /givecar [playerid]"); new player1 = strval(params), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); if(IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle"); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) { CMDMessageToAdmins(playerid,"GIVECAR"); new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); CarSpawner(player1,487); GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); format(string,sizeof(string),"Administrator %s has given you a car",adminname); SendClientMessage(player1,blue,string); format(string,sizeof(string),"You have given %s a car", playername); return SendClientMessage(playerid,blue,string); } else return SendClientMessage(playerid, red, "Player is not connected or is yourself"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); }
EDIT: Guess I found it,
new cmd[256], string[128], tmp[256], idx; means the second number in dcmd equals to the length of the command, will try out now.