22.04.2012, 00:44
Hey folks I need to pass these commands to zcmd
thanks hopefully they can
sorry my lenguage
/createorg
/setorgveh
thanks hopefully they can
sorry my lenguage
/createorg
pawn Код:
if(strcmp(cmd,"/createorg",true) == 0)
{
new tmp[256],tmp2[256];
tmp = strtok(cmdtext,idx);
tmp2 = strtok(cmdtext,idx);
new orgid = strval(tmp);
new orggenre = strval(tmp2);
if(!IsPlayerAdmin(playerid)) return 0;
if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /createorg [orgid] [genre] [name]");
if(orgid > MAX_ORGS) return SendClientMessage(playerid,COLOR_ORED,"Too high. Max org limitation exceed.");
new file[55];
format(file,sizeof file,"org%d.ini",orgid);
if(fexist(file)) return SendClientMessage(playerid,COLOR_ORED,"Organization ID already in use.");
if(orggenre > 3 || orggenre < 1) return SendClientMessage(playerid,COLOR_ORED,"Only 3 genre avaliable.");
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
dini_Create(file);
dini_Set(file,"Name",result);
dini_IntSet(file,"Genre",orggenre);
dini_IntSet(file,"Ammo",100);
new str2[256];
format(str2,256,"** You have created organization id %d, %s.",orgid,result);
SendClientMessage(playerid,COLOR_YELLOW,str2);
return 1;
}
pawn Код:
if(strcmp(cmd,"/setorgveh",true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
new tmp[256],tmp2[256];
tmp = strtok(cmdtext,idx);
tmp2 = strtok(cmdtext,idx);
if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgveh [orgid] [car[1-8]]");
if(!IsNumeric(tmp) || !IsNumeric(tmp2)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgveh [orgid] [car[1-8]]");
new filo[256];
new orgids = strval(tmp);
new cars = strval(tmp2);
if(cars > 8 || cars < 1) return SendClientMessage(playerid,COLOR_ORED,"Car ID 1-8");
format(filo,256,"org%d.ini",orgids);
if(!fexist(filo)) return SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
new Float:X,Float:Y,Float:Z,Float:A;
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,COLOR_ORED,"You aren't in any vehicle.");
GetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
GetVehicleZAngle(GetPlayerVehicleID(playerid),A);
if(cars == 1)
{
dini_IntSet(filo,"Model1",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X1",X);
dini_FloatSet(filo,"Y1",Y);
dini_FloatSet(filo,"Z1",Z);
dini_FloatSet(filo,"A1",A);
OrgInfo[orgids][Car1] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
if(cars == 2)
{
dini_IntSet(filo,"Model2",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X2",X);
dini_FloatSet(filo,"Y2",Y);
dini_FloatSet(filo,"Z2",Z);
dini_FloatSet(filo,"A2",A);
OrgInfo[orgids][Car2] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
if(cars == 3)
{
dini_IntSet(filo,"Model3",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X3",X);
dini_FloatSet(filo,"Y3",Y);
dini_FloatSet(filo,"Z3",Z);
dini_FloatSet(filo,"A3",A);
OrgInfo[orgids][Car3] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
if(cars == 4)
{
dini_IntSet(filo,"Model4",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X4",X);
dini_FloatSet(filo,"Y4",Y);
dini_FloatSet(filo,"Z4",Z);
dini_FloatSet(filo,"A4",A);
OrgInfo[orgids][Car4] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
if(cars == 5)
{
dini_IntSet(filo,"Model5",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X5",X);
dini_FloatSet(filo,"Y5",Y);
dini_FloatSet(filo,"Z5",Z);
dini_FloatSet(filo,"A5",A);
OrgInfo[orgids][Car5] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
if(cars == 6)
{
dini_IntSet(filo,"Model6",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X6",X);
dini_FloatSet(filo,"Y6",Y);
dini_FloatSet(filo,"Z6",Z);
dini_FloatSet(filo,"A6",A);
OrgInfo[orgids][Car6] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
if(cars == 7)
{
dini_IntSet(filo,"Model7",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X7",X);
dini_FloatSet(filo,"Y7",Y);
dini_FloatSet(filo,"Z7",Z);
dini_FloatSet(filo,"A7",A);
OrgInfo[orgids][Car7] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
if(cars == 8)
{
dini_IntSet(filo,"Model8",GetVehicleModel(GetPlayerVehicleID(playerid)));
dini_FloatSet(filo,"X8",X);
dini_FloatSet(filo,"Y8",Y);
dini_FloatSet(filo,"Z8",Z);
dini_FloatSet(filo,"A8",A);
OrgInfo[orgids][Car8] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
}
new sl[256];
format(sl,256,"** You have set vehicle id %d to organization vehicle, %s (Carid:%d).",GetVehicleModel(GetPlayerVehicleID(playerid)),dini_Get(filo,"Name"),cars);
SendClientMessage(playerid,COLOR_MAIN,sl);
return 1;
}
pawn Код:
if(strcmp(cmd,"/setorgskin", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
new tmp[256],tmp2[256],tmp3[256];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext,idx);
tmp3 = strtok(cmdtext,idx);
if(!strlen(tmp) || !strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgskin [ORGID] [Skin [1-2]] [SkinID]");
new orgido = strval(tmp);
new wichskin = strval(tmp2);
new skinid = strval(tmp3);
new filo[256];
format(filo,256,"org%d.ini",orgido);
if(!fexist(filo)) return SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
if(wichskin < 1 || wichskin > 2) return SendClientMessage(playerid,COLOR_ORED,"Please choose between 1-2 for skin id.");
if(wichskin == 1)
{
dini_IntSet(filo,"Skin1",skinid);
}
if(wichskin == 2)
{
dini_IntSet(filo,"Skin2",skinid);
}
new stringo[256];
format(stringo,256,"** You have sucessfully changed the skin to skin id %d.",skinid);
SendClientMessage(playerid,COLOR_MAIN,stringo);
return 1;
}
if(strcmp(cmd,"/setorgcol",true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
new tmp[256],tmp2[256];
tmp = strtok(cmdtext,idx);
tmp2 = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgcol [orgid] [newcol]");
new format1[256];
new filo[256];
format(filo,256,"org%d.ini",strval(tmp));
if(!fexist(filo)) return SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
format(format1,256,"** You have sucessfully change organization %s color id to %s.",dini_Get(filo,"Name"),tmp2);
SendClientMessage(playerid,COLOR_MAIN,format1);
dini_Set(filo,"Color",tmp2);
return 1;
}
if(strcmp(cmd,"/setorggenre",true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
new tmp[256],tmp2[256];
tmp = strtok(cmdtext,idx);
tmp2 = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorggenre [orgid] [genre][1-3]");
if(!strlen(tmp2) || strval(tmp2) > 3 || strval(tmp2) < 1) return SendClientMessage(playerid,COLOR_ORED,"Genre 1-3");
if(OrgInfo[strval(tmp)][Genre] == strval(tmp2)) return SendClientMessage(playerid,COLOR_ORED,"That organization is already in this genre.");
new filo[256];
format(filo,55,"org%d.ini",strval(tmp));
if(!fexist(filo)) return SendClientMessage(playerid,COLOR_ORED,"Organization id doesnt exist.");
dini_IntSet(filo,"Genre",strval(tmp2));
OrgInfo[strval(tmp)][Genre] = strval(tmp2);
return 1;
}
if(strcmp(cmd,"/setorgcarcol",true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
new tmp[256],tmp2[256],tmp3[256];
tmp = strtok(cmdtext,idx);
tmp2 = strtok(cmdtext,idx);
tmp3 = strtok(cmdtext,idx);
if(!strlen(tmp) || !strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgcol [orgid] [col1] [col2]");
new orgid12 = strval(tmp);
new col1 = strval(tmp2);
new col2 = strval(tmp3);
new filo[256];
format(filo,256,"org%d.ini",orgid12);
if(!fexist(filo)) return SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
dini_IntSet(filo,"Col1",col1);
dini_IntSet(filo,"Col2",col2);
ChangeVehicleColor(OrgInfo[orgid12][Car1],col1,col2);
ChangeVehicleColor(OrgInfo[orgid12][Car2],col1,col2);
ChangeVehicleColor(OrgInfo[orgid12][Car3],col1,col2);
ChangeVehicleColor(OrgInfo[orgid12][Car4],col1,col2);
ChangeVehicleColor(OrgInfo[orgid12][Car5],col1,col2);
ChangeVehicleColor(OrgInfo[orgid12][Car6],col1,col2);
ChangeVehicleColor(OrgInfo[orgid12][Car7],col1,col2);
ChangeVehicleColor(OrgInfo[orgid12][Car8],col1,col2);
SendClientMessage(playerid,COLOR_ORED,"Sucessfully change vehicle color.");
return 1;
}
if(strcmp(cmd,"/setorgname",true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORED,"UASGE: /setorgname [OrgID] [New Name]");
new filo[256];
format(filo,256,"org%d.ini",strval(tmp));
if(!fexist(filo)) return SendClientMessage(playerid,COLOR_ORED,"That organization ID doesnt exist.");
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgname [OrgID] [New Name]");
dini_Set(filo,"Name",result);
new fm2[256];
format(fm2,256,"** You have sucessfully changed the organization name to %s.",result);
SendClientMessage(playerid,COLOR_MAIN,fm2);
return 1;
}
pawn Код:
if(strcmp(cmd, "/oc", true) == 0)
{
if(Member[playerid] == -255) return 0;
new length = strlen(cmdtext);
new playrname[MAX_PLAYERS];
new string[256];
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /oc [text]");
GetPlayerName(playerid, playrname, sizeof(playrname));
format(string,sizeof(string),"OrgChat - %s : %s", playrname,result);
if(Member[playerid] != -255)
{
for(new i=0;i<MAX_PLAYERS;i++)
{ if(IsPlayerConnected(i) && Member[i] == Member[playerid])
SendClientMessage(i,COLOR_MAIN,string);
}
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/request", true) == 0)
{
new orgcounting = 0;
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_LIGHTGREEN,"-------- Organization List ---------");
new strr[256];
for(new i = 0;i<MAX_ORGS;i++)
{
new tformi[256];
format(tformi,sizeof tformi,"org%d.ini",i);
if(fexist(tformi))
{
format(strr,256,"%s - Organization ID: %d || Leader: %s",dini_Get(tformi,"Name"),i,dini_Get(tformi,"Leader"));
SendClientMessage(playerid,COLOR_WHITE,strr);
orgcounting++;
}
if(orgcounting == 0)
{
SendClientMessage(playerid,COLOR_GREY,"We're sorry but theres no organization created at the moment.");
return 1;
}
}
SendClientMessage(playerid,COLOR_ORED,"USAGE: /request [orgid]");
return 1;
}
if(!IsNumeric(tmp))
{
SendClientMessage(playerid,COLOR_LIGHTGREEN,"-------- Organization List ---------");
new strr[256];
for(new i = 0;i<MAX_ORGS;i++)
{
new tformi[256];
format(tformi,sizeof tformi,"org%d.ini",i);
if(fexist(tformi))
{
format(strr,256,"%s - Organization ID: %d || Leader: %s",dini_Get(tformi,"Name"),i,dini_Get(tformi,"Leader"));
SendClientMessage(playerid,COLOR_WHITE,strr);
orgcounting++;
}
if(orgcounting == 0) return SendClientMessage(playerid,COLOR_GREY,"We're sorry but theres no organization created at the moment.");
}
SendClientMessage(playerid,COLOR_ORED,"Error: Organization ID must be number.");
return 1;
}
new filo[256];
format(filo,256,"org%d.ini",strval(tmp));
if(!fexist(filo))
{
SendClientMessage(playerid,COLOR_LIGHTGREEN,"-------- Organization List ---------");
new strr[256];
for(new i = 0;i<MAX_ORGS;i++)
{
new tformi[256];
format(tformi,sizeof tformi,"org%d.ini",i);
if(fexist(tformi))
{
format(strr,256,"%s - Organization ID: %d || Leader: %s",dini_Get(tformi,"Name"),i,dini_Get(tformi,"Leader"));
SendClientMessage(playerid,COLOR_WHITE,strr);
orgcounting++;
}
if(orgcounting == 0) return SendClientMessage(playerid,COLOR_GREY,"We're sorry but theres no organization created at the moment.");
}
SendClientMessage(playerid,COLOR_ORED,"Error: Organization ID is not valid.");
return 1;
}
if(fexist(filo))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && Leader[i] == 1 && Member[i] == strval(tmp))
{
if(request[playerid] != -255) return SendClientMessage(playerid,COLOR_ORED,"You are already requesting to join an organization.");
if(Member[playerid] != -255) return SendClientMessage(playerid,COLOR_ORED,"You are already in an organization.");
new stringa[256];
new nama[MAX_PLAYER_NAME];
GetPlayerName(playerid,nama,MAX_PLAYER_NAME);
format(stringa,256,"** %s is requesting to join %s.",nama,dini_Get(filo,"Name"));
SendClientMessageToAll(COLOR_MAIN,stringa);
request[playerid] = strval(tmp);
new strin[256];
format(strin,256,"[Request] %s is requesting to join your organization. /setmember to accept || /decline to reject.",nama);
SendClientMessage(i,COLOR_WHITE,strin);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_ORED,"Error: The Organization Leader appears to be offline.");
return 1;
}
}
return 1;
}
return 1;
}
if(strcmp(cmd,"/cancelrequest",true) == 0)
{
new form[256];
new nama[MAX_PLAYER_NAME];
GetPlayerName(playerid,nama,sizeof(nama));
new file[256];
format(file,256,"org%d.ini",request[playerid]);
if(!fexist(file))
{
SendClientMessage(playerid,COLOR_ORED,"That organization doesn't exist anymore.");
request[playerid] = -255;
return 1;
}
format(form,256,"** %s has cancel his/her request to join %s.",nama,dini_Get(file,"Name"));
SendClientMessageToAll(COLOR_MAIN,form);
request[playerid] = -255;
return 1;
}