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



2 problems - Marshalb2k - 29.03.2015

Hello, I got 2 problems in script
Hello, as I wrote in the script TITLE have 2 problems and do not really know how to fix them.

First, to explain, is the job of Trucker, when taking a checkpoint occurs where my trailer to transport, it's ok so far, they reach the checkpoint get into it and receive reward but the trailer does not disappear (no respawn), how i can respawn the trailer??

Quote:
if(strcmp(cmd,"/delivery",true) == 0)
{
if(PlayerInfo[playerid][pJob] == 16)
{
if(PlayerToPoint(10.0,playerid,-48.4468,-1146.9323,1.0781))
{
if(IsPlayerInAnyVehicle(playerid))
{
new carid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(carid);
if(model == 403)
{
if(IsAnyTrailerAttachedToVehicle(carid))
{
if(acceptgruz[playerid] > 0)
{
SendClientMessage(playerid,COLOR_GREY,"Can't you accepted drugs!");
return 1;
}
new randik = random(7);
if(randik == 0)
{
DisablePlayerCheckpoint(playerid);
checkpointd[playerid] = SetPlayerCheckpoint(playerid,-59.0808,0.1278,3.1172,8.0);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"I put you one red mark on the map !");
acceptgruz[playerid] = 1;
}
else if(randik == 1)
{
DisablePlayerCheckpoint(playerid);
checkpointd[playerid] = SetPlayerCheckpoint(playerid,-1017.7874,-681.4913,32.0078,8.0);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"I put you one red mark on the map !");
acceptgruz[playerid] = 2;
}
else if(randik == 2)
{
DisablePlayerCheckpoint(playerid);
checkpointd[playerid] = SetPlayerCheckpoint(playerid,823.9176,854.6870,11. 8571,8.0);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"I put you one red mark on the map !");
acceptgruz[playerid] = 3;
}
else if(randik == 3)
{
DisablePlayerCheckpoint(playerid);
checkpointd[playerid] = SetPlayerCheckpoint(playerid,578.8217,1221.5995,11 .7113,8.0);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"I put you one red mark on the map !");
acceptgruz[playerid] = 4;
}
else if(randik == 4)
{
DisablePlayerCheckpoint(playerid);
checkpointd[playerid] = SetPlayerCheckpoint(playerid,266.3958,1407.6863,10 .4828,8.0);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"I put you one red mark on the map !");
acceptgruz[playerid] = 5;
}
else if(randik == 5)
{
DisablePlayerCheckpoint(playerid);
checkpointd[playerid] = SetPlayerCheckpoint(playerid,-1890.8984,-1731.3362,21.7500,8.0);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"I put you one red mark on the map !");
acceptgruz[playerid] = 6;
}
else if(randik == 6)
{
DisablePlayerCheckpoint(playerid);
checkpointd[playerid] = SetPlayerCheckpoint(playerid,2783.4919,-2475.8999,13.6347,8.0);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"I put you one red mark on the map !");
acceptgruz[playerid] = 7;
}
}
else
{
SendClientMessage(playerid,COLOR_GREY,"Nu ai nici o remorca , remorcata cu tirul!");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You are not in to tir!");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You are not in to vehicul!");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You are not la puctul 'Delevery' ");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You are not Trucker!");
}
return 1;
}

And the 2nd issue is CNN, spam can be done elsewhere, so I give / give ad whenever I want without time. how can I put time, like one minute until you can also give the following announcement.

Quote:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "*You are not {B22222}Logat !");
return 1;
}
if(PlayerInfo[playerid][pPnumber] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You dont have Phone!");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_LIGHTRED2, "* You not have Level 3!");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You have Mute, and cannot use /ad!");
return 1;
}
if(!PlayerToPoint(3.0, playerid, 844.6591,-1045.4973,25.4305))
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not on CNN LS!");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[150];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_CMD, "[INFO] {FFFFFF} (/ad)vertise [Advert]");
return 1;
}
spaceGroupsToSpaces(result);
trimSideSpaces(result);
new word[256],Index;while(Index < strlen(result)) { // проверка сообщения на рекламу серверов и ее вырезание
word = strtok(result,Index);
if(Adv(word)==1||ZP(word)||U(word)||T(word)||N(wor d)||PP(word)||P(word)||V(word)||R(word)||PL(word)| |ZV(word)||I(word)||ST(word)||PR(word)||DL(word)|| RE(word)||VOC(word)||A(word)||NO(word)||TCZ(word)| |BOP(word)){
new i=strfind(result,word),j=i+strlen(word)-1; result[i++]='[';
while(i<j) {result[i]='|';i++;}
result[j]=']';
BanEx(playerid, " Reclama la alt server");
}
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You have Mute.");
return 1;
}
if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
{
format(string, sizeof(string), " Mai sunt %d pana cand poti sa dai /ad", (addtimer/30000));
SendClientMessage(playerid, COLOR_GRAD2, string);
return 1;

}
new payout = idx * 25;
if(GetPlayerMoney(playerid) < payout)
{
format(string, sizeof(string), "* For %d caracters, you payoff $%d. Ad have been posted.", offset, payout);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
GivePlayerMoney(playerid, - payout);
SBizzInfo[7][sbTill] += payout*3;
ExtortionSBiz(7, payout);
format(string, sizeof(string), "{00BF00}Advert placed by:{FFFFFF} %s, {00BF00}Phone:{FFFFFF} %d :{00BF00} %s", sendername,PlayerInfo[playerid][pPnumber],result);
OOCNews(TEAM_GROVE_COLOR,string);
format(string, sizeof(string), "(AdmInf):Player: %s (ID:%d) :- (Added this Advert)",sendername,playerid);
ABroadCast(COLOR_LIGHTRED,string,1);
format(string, sizeof(string), "-Money: $%d. caracters: %d.", payout, idx);
SendClientMessage(playerid, COLOR_GRAD1, string);
if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 3000); adds = 1;}
}
return 1;
}

Sorry for me english, i hope as u will understand the problem.
Please help me to fix 2 erors.


Re: 2 problems - CrossOv3r - 29.03.2015

wiki.sa-mp.com/wiki/GetVehicleTrailer